Enabling JIT-Attach Debugging
Note
This article is specific to .NET Framework. It doesn't apply to newer implementations of .NET, including .NET 6 and later versions.
JIT-attach debugging is the phrase used to describe attaching a debugger to a process when you encounter errors, or it can be triggered by specific methods or functions.
JIT-attach debugging is used under the following fault conditions:
Unhandled exceptions (in both native and managed code).
Environment.FailFast method or RaiseFailFastException function (Windows 7 family).
Runtime fatal errors.
JIT-attach debugging is also triggered by calls to the following methods and functions:
Debugger.Launch method.
Debugger.Break method.
DebugBreak function (Win32).
Before the .NET Framework 4, the .NET Framework provided separate registry keys to control the behavior of native and managed debuggers. Starting with the .NET Framework 4, control is consolidated under a single registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug
. The values you can set for that key determine whether a debugger is invoked, and, if so, whether it is invoked with a dialog box that requires user interaction. For information about setting this registry key, see Configuring Automatic Debugging.