Export (0) Print
Expand All

Enabling JIT-attach Debugging

JIT-attach debugging is the phrase used to describe attaching a debugger to an executable image, which throws an uncaught exception. In unmanaged code, it is what happens when you see a message box that invites you to:

  • Click OK to terminate the program
  • Click CANCEL to debug the program

If you click CANCEL, a debugger is started and attached to the process. The registry key that controls this is called HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version\AeDebug.

For an application that includes managed code, the common language runtime will present a similar dialog to JIT-attach a debugger. The registry key that controls this option is called HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\DbgJITDebugLaunchSetting.

  • If value = 0, prompt the user by means of a message box. The choices are:
    • Continue. This results in a stack dump and process termination.
    • Attach a debugger. In this case, the runtime spawns the debugger listed in the DbgManagedDebugger registry key. If none, control is returned, and the process is terminated.
  • If value = 1, simply return control. This results in a stack dump, after which the process is terminated.
  • If value = 2, spawn the debugger listed in the DbgManagedDebugger registry key.

See Also

Debugging and Profiling | Making an Image Easier to Debug | Enabling Profiling

Show:
© 2014 Microsoft