15

Not too long ago, I had a problem which required me to set WinDbg.exe as the default post-mortem debugger. Now that I've fixed that and am back doing normal work, it would be really nice if I could set VS to be my default post-mortem debugger. How does one go about doing this?

Also, how do I make VS attach to an already existing session? That is, I've got my VS project open in one window, and a command line open where I'm launching my program from. If the program crashes, how do I get VS to figure out to attach the debugger to the active line in the project that's already open?

Community
  • 1
  • 1
Nik Reiman
  • 37,525
  • 27
  • 102
  • 159

2 Answers2

26

You can re-enable Visual Studio for Just-In-Time debugging from within Visual Studio:

Go to the Tools | Options | Debugging | Just-In-Time dialog. Then make sure all Native and Managed (if you're debugging a .NET application) are checked. Next time you get a crash, the Visual Studio Just-In-Time debugger will come up.

The Visual Studio Just-In-Time debugger let's you choose whether you want to open a new instance of Visual Studio or start debugging with a currently open solution.

Josh Sklare
  • 3,864
  • 3
  • 21
  • 17
  • In later versions of Windows you must turn off WER. For Windows 10 [see here](https://superuser.com/questions/950997/disable-error-reporting-in-windows-10-home). – Nick Westgate Apr 01 '18 at 00:04
9

from the Microsoft support page:

1.  Start Registry Editor and locate the following Registry subkey in the HKEY_LOCAL_MACHINE subtree:

\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AEDEBUG
2.  Select the Debugger value.
3.  On the Edit menu, click String.

•   To use the Windows debugger, type windbg -p %ld -e %ld.
•   To use Visual C++ 4.2 or earlier, type msvc -p %ld -e %ld.
•   To use Visual C++ 5.0 or later, type msdev.exe -p %ld -e %ld.
•   To use Dr. Watson, type drwtsn32.exe -p %ld -e %ld. You can also make Dr. Watson the default debugger by running this command:drwtsn32.exe -i.
4.  Choose OK and exit Registry Editor. 
MvdD
  • 20,035
  • 6
  • 59
  • 89