There are several different behaviors that can occur when a managed application throws an unhandled exception. The two most common are to bring up an error dialog box, or to pop up the Visual Studio Just In Time Debugger dialog box.
The first behavior is the default when you install the CLR, but don't install Visual Studio. Installing VS modifies the default to pop up the select-a-debugger dialog. How does the CLR figure out what behavior to use? It checks a registry key, located at HKLM\Software\Microsoft\.NetFramework\DbgJITDebugLaunchSetting. The value of this key lets the CLR know what to do when it encounters an unhandled exception. Possible values are:
If the value is set to 2, then the CLR consults HKLM\Software\Microsoft\.NetFramework\DbgManagedDebugger to determine which debugger to launch. This debugger is expected to be a managed debugger, that uses the CLR debugging interface. The debugger listed in this key will get four parameters, specified using printf style % format characters. The parameters are:
By default, Visual Studio registers the VSJITDebugger.exe program as the debugger, which is what is responsible for displaying the familiar choose-a-debugger dialog box. The default registration for this debugger in Visual Studio 2003 is: