Just-In-Time (JIT) debugging lets a debugger such as Visual Studio attach automatically when a program crashes outside it, so you can see the exact line and call stack that failed instead of a generic “has stopped working” message. This guide shows how to turn it on in Visual Studio, how to enable it for Windows Forms apps that show the “To enable just-in-time (JIT) debugging” message, how the registry settings work, how to use WinDbg instead, and how to turn JIT debugging off again. The steps apply to Windows 10 and Windows 11.
Quick Answer
Open Visual Studio as an administrator, go to Tools > Options > Debugging > Just-In-Time, check Managed, Native and Script, and click OK. For a Windows Forms app, also add <system.windows.forms jitDebugging=”true” /> to the app’s .config file.

Before You Start
- You need a debugger installed. Visual Studio (including the free Community edition) or WinDbg both work. Visual Studio Code does not register itself as a JIT debugger.
- You need admin rights, because the settings are written to the machine-wide registry.
- The Just-In-Time debugger component must be installed. If the Just-In-Time page is missing, open the Visual Studio Installer, click Modify, select Individual components, and check Just-In-Time debugger.
- JIT debugging is meant for developers and testers. On an everyday PC, leaving it on means crashes pop up a debugger prompt instead of closing.
Method 1: Enable JIT Debugging in Visual Studio
- Right-click Visual Studio in the Start menu and choose Run as administrator.
- Go to Tools > Options.
- Expand Debugging and select Just-In-Time. (In newer builds with the redesigned Options window, search for “Just-In-Time”.)
- Under Enable Just-In-Time debugging for these types of code, check:
- Managed for .NET code such as C# and VB
- Native for C and C++ programs
- Script for script hosted in legacy browser engines (optional)
- Click OK.
If a warning says another debugger is registered, or the checkboxes won’t stay checked, Visual Studio wasn’t run as administrator or another tool has taken over the registry values. Rerun as admin and check again.
Method 2: Enable JIT Debugging for a Windows Forms App
.NET Framework Windows Forms apps catch unhandled exceptions with their own dialog, which says JIT debugging must be enabled in the config file. Visual Studio’s setting alone isn’t enough for these apps.
- Find the app’s config file next to the .exe. It’s named after the program, for example MyApp.exe.config. In a project, edit App.config and rebuild.
- Inside the <configuration> element, add:
<system.windows.forms jitDebugging="true" /> - Save and run the app. On the next unhandled exception, you’ll get the Just-In-Time Debugger prompt instead of the Windows Forms error box.
A machine-wide version of this setting exists in machine.config, but changing it affects every Windows Forms app on the PC, so use the per-app file whenever possible. For a debug build, also compile with debug symbols (the Debug configuration) so you can see source lines.
Method 3: Check or Set the Registry Values
Visual Studio writes these keys for you. Knowing them helps when JIT debugging stops working or you need to switch debuggers. Back up the registry before editing.
- Native code (64-bit): HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug. The Debugger value holds the debugger’s command line, and Auto set to 0 shows a prompt while 1 attaches without asking.
- Native code (32-bit programs on 64-bit Windows): the same path under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug.
- Managed code: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework (and its WOW6432Node counterpart), in the DbgManagedDebugger value.
If a crash reporter or another tool has replaced the Debugger value, re-open Visual Studio as administrator and re-save the Just-In-Time settings; it rewrites them.
Method 4: Use WinDbg as the Postmortem Debugger
- Install WinDbg (from the Microsoft Store or as part of the Windows SDK’s Debugging Tools for Windows).
- Open Command Prompt as administrator.
- For the classic WinDbg in the SDK, go to its install folder and run windbg -I (capital i). This registers it in the AeDebug key and sets Auto to 1.
- Repeat with the 32-bit WinDbg if you also need to catch 32-bit program crashes.
The newer Store version of WinDbg has its own registration steps; check its documentation, as the command line differs between releases.
What Happens When a Program Crashes
- The Visual Studio Just-In-Time Debugger dialog appears and lists available debuggers, such as a new instance of Visual Studio or one already open.
- Pick one and click OK (or Yes).
- Visual Studio breaks at the exception. If you have the source and symbol (.pdb) files, you’ll see the failing line; otherwise, you’ll see disassembly and the call stack.
How to Turn Off JIT Debugging
- In Visual Studio (as admin), go to Tools > Options > Debugging > Just-In-Time and clear the checkboxes.
- If Visual Studio has been uninstalled but crash prompts still appear, delete the Debugger value under both AeDebug keys and DbgManagedDebugger under both .NETFramework keys.
- Remove the jitDebugging line from any Windows Forms config files you changed.
Troubleshooting
| Problem | Fix |
|---|---|
| Just-In-Time page missing | Install the Just-In-Time debugger component in Visual Studio Installer |
| Checkboxes won’t save | Run Visual Studio as administrator |
| Windows Forms error box still shows | Add jitDebugging=”true” to the app’s .config |
| 32-bit app crashes aren’t caught | Check the WOW6432Node AeDebug key |
| Debugger opens but shows no source | Build in Debug and keep the .pdb files next to the .exe |
| Prompt appears for every crash on a non-dev PC | Turn JIT debugging off |
Frequently Asked Questions
Is JIT debugging related to the .NET JIT compiler?
Only by name. The JIT compiler turns .NET code into machine code at run time; JIT debugging attaches a debugger when a crash happens.
Does this work on Windows 11?
Yes. The steps are the same. Windows 10 reached end of support on October 14, 2025.
Is it safe to leave on?
It’s safe, but it changes how crashes behave. Turn it off on PCs used by people who aren’t developers.
Can I attach to a running program instead?
Yes. In Visual Studio, use Debug > Attach to Process for a program that’s running but not crashed.
Summary
- Run Visual Studio as administrator.
- Tools > Options > Debugging > Just-In-Time, check Managed, Native and Script.
- For Windows Forms apps, add jitDebugging=”true” to the .config file.
- Use the AeDebug and .NETFramework registry keys to check or reset the debugger.
- Clear the checkboxes or registry values to turn it off.

Kermit Matthews is a freelance writer based in Philadelphia, Pennsylvania with more than a decade of experience writing technology guides. He has a Bachelor’s and Master’s degree in Computer Science and has spent much of his professional career in IT management.
He specializes in writing content about iPhones, Android devices, Microsoft Office, and many other popular applications and devices.