Share via


Enabling JIT-attach Debugging

JIT-attach debugging is the phrase used to describe attaching a debugger to an executable image that throws an uncaught exception. In unmanaged code, JIT-attach debugging is started by a message box that invites you to click OK to terminate the program, or click Cancel to debug the program.

If you click Cancel, a debugger is started and attached to the process.

If an application includes managed code, the common language runtime presents a similar message box to JIT-attach a debugger. The registry subkey that controls this option is DbgJITDebugLaunchSetting, which is located in the HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework subkey. DbgJITDebugLaunchSetting may have the following values:

  • If value = 0, prompt the user by displaying a message box. This only applies to processes that are interactive with the desktop; services and other noninteractive processes will terminate.

    In the .NET Framework version 2.0 the message box includes the following choices:

    • Send. An error report is sent to Microsoft, followed by process termination. See the Windows Quality Online Services (Winqual) Web site for information about how to retrieve these reports.

    • Don't Send. This results in a stack dump to the console and process termination.

    • Debug. The runtime spawns the debugger that is listed in the DbgManagedDebugger registry subkey. If no debugger is found, 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 that is listed in the DbgManagedDebugger registry subkey.

  • If value = 16, in the .NET Framework version 2.0 only, the runtime presents the message box described for value = 0 for processes that are interactive with the desktop. For processes that are not interactive, the runtime spawns the debugger that is listed in the DbgManagedDebugger registry subkey. This is the default setting for the .NET Framework version 2.0.

See Also

Concepts

Making an Image Easier to Debug

Enabling Profiling

Other Resources

Debugging and Profiling Applications

Change History

Date

History

Reason

January 2010

Corrected references to registry values.

Customer feedback.