The debugger may not break on breakpoints when you try to debug an ATL Microsoft Management Console (MMC) Snap-In on a Windows NT 4.0 computer (193513)



The information in this article applies to:

  • The Microsoft Active Template Library (ATL) 3.0, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
    • The Integrated Debugger

This article was previously published under Q193513

SYMPTOMS

The debugger may not break on your breakpoints when you try to debug an ATL MMC (Microsoft Management Console) Snap-In on a Windows NT 4.0 computer.

CAUSE

The ATL Object Wizard adds code that registers objects differently. The About object uses the DECLARE_REGISTRY() macro for registering itself. Other objects in the same Snap-In use an .rgs file. As a result, the About object is registered using a long file name (in the InprocServer32 key). Other objects are registered with a short file name.

MMC first creates the About object and loads the DLL with the long file name. When other objects are created by MMC, the DLL is reloaded in a different memory location with the short file name. Debugger breakpoints (int 3 instructions) are inserted in the context of the first DLL, so any code executed in the context of the second DLL won't have any int 3 instructions, and therefore breakpoints are not hit.

WORKAROUND

You can use one of the following four workarounds:
  • Workaround 1

    Use a directory and project name that does not use long file names.
  • Workaround 2

    Change the About object to use the .rgs file as shown below:

    1. Create a new registry file and edit it as follows (replacing the CLSID and class name):
            HKCR
             {
                MyClassAbout.1 = s 'MyClassAbout Class'
                {
                   CLSID = s '{22A88065-391D-11D2-8164-00C04F7948A7}'
                   CurVer = s 'MyClassAbout.1'
                }
                NoRemove CLSID
                {
                   ForceRemove
             {22A88065-391D-11D2-8164-00C04F7948A7} = s 'MyClassAbout Class'
                   {
                      ProgID = s 'MyClassAbout.1'
                      VersionIndependentProgID = s 'MyClassAbout.1'
                      ForceRemove 'Programmable'
                      InprocServer32 = s '%MODULE%'
                      {
                         val ThreadingModel = s 'Both'
                      }
                   }
                }
             }
      								
    2. Save the new registry file as MyClassAbout.rgs and import this file into your project resource. Change its id to IDR_MYCLASSABOUT.
    3. Replace the DECLARE_REGISTRY line in the About class with the following:
         DECLARE_REGISTRY_RESOURCEID(IDR_MYCLASSABOUT)
      								
    4. Rebuild all.
  • Workaround 3

    Unregister the DLL and comment out the object entry for the About object when debugging.
  • Workaround 4

    Use _asm int 3 or DebugBreak or ATLASSERT(0) to break into the debugger and set/re-enable your break points.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Modification Type:MajorLast Reviewed:9/2/2005
Keywords:kbprb kbtshoot kbDebug kbFAQ kbNoUpdate kbpending KB193513 kbAudDeveloper