JIT debugging attaches a registered debugger to an application when an unhandled exception is raised or otherwise crashes. The JIT debugger for these events can be set in the registry. You can inspect the registry using the Regedit tool. In this text, HKLM is shorthand for HKEY_LOCAL_MACHINE.
For managed code, the following key manages JIT debugging:
The DbgJITDebugLaunchSetting value at this key sets the behavior of the just-in-time dialog box. There are three possible values. A value of zero requests that the Microsoft Error Reporting dialog box is displayed for JIT debugging. In the Microsoft Error Reporting dialog box, click the Don't Send button to launch the JIT debugging dialog box. Both the Microsoft Error Reporting and the JIT debugging dialog boxes are shown in Figures 13-1 and 13-2. A value of 1 causes the Microsoft Error Reporting dialog box to be suppressed. A value of 2 forces the JIT debugging dialog box to be displayed when JIT debugging occurs. However, the Microsoft Error Reporting dialog box is not shown. The default value for DbgJITDebugLaunchSetting is zero. In addition to the DbgJITDebugLaunchSetting value, you can name the managed JIT debugger in the DbgManagedDebugger value. Figure 13-3 has the managed debugging key and values.
For unmanaged code, you configure JIT debugging at the following registry key:
The Auto value of this key controls the Just-in-Time Debugging dialog box. Zero causes the Microsoft Error Reporting dialog box to be displayed. If the Debug button is clicked on the Microsoft Error Reporting dialog box, the Just-in-Time Debugging dialog box is displayed next. A value of 1 displays the Just-in-Time Debugging dialog box directly. The Debugger value of the AeDebug registry key holds the name of the JIT unmanaged debugger.
Visual Studio .NET is named as the default managed and unmanaged debugger when the product is installed. If that changes, you can reappoint Visual Studio .NET as the default debugger from the Tools menu and the Options dialog box. Choose the Just-In-Time section in the Debugging pane. From that window, choose the types of code for which Visual Studio .NET should be the JIT debugger.
Figure 13-4 shows the JIT debugging selections.
You can install other debuggers as the default JIT debugger. The I startup option of the WinDbg or Dr. Watson tools installs either as the default unmanaged debugger. You can also manually change the registry to make these tools the default managed or unmanaged JIT debuggers: