Visual Studio not breaking on user-unhandled exceptions

DebuggingExceptionVisual Studio-2012Ide

Debugging Problem Overview


When running my app in Visual Studio, it's ending on unhandled exceptions rather than showing a message box with the exception info and continuing on as I'm accustomed to.

What options do I need to change to get it back to the behavior I'm used to?

Edit: In Debug/Exceptions I do have the User-unhandled option selected for CLR Exceptions.

Debugging Solutions


Solution 1 - Debugging

For visual studio 2015 :

1.Open Exception settings window (it's new in 2015) open Exception settings window (it's new in 2015)

2.Check All CLR Exceptions enter image description here

3.If you don't need visual studio to throw specific exceptions uncheck this enter image description here

Solution 2 - Debugging

Debug->Exceptions->Check Thrown/User-Unhandled for Common Language Runtime Exceptions

edit: Maybe try to do a clean/rebuild, and run again? Maybe debug symbols are corrupt or something..

Solution 3 - Debugging

Depending on the application, the following options may help you:

Tools → Options... → Debugging → General

  • Break when exceptions cross AppDomain or managed/native boundaries (Managed only)
  • Enable the exception assistant
    • Unwind the call stack on unhandled exceptions

[Note: Based on comments below, the following tip did not work and, for some, created the problem answer was intended to solve: use with caution...]

  • Uncheck Enable Just My Code ← JMC can prevent you from catching exceptions in code that's not yours and/or is missing symbols.

Solution 4 - Debugging

In my case, when I went to Debug -> Exceptions, the User-unhandled column was missing. Going to Debug -> Options and Settings and enabling Enable Just My Code fixed this, which consequently fixed this problem altogether.

Solution 5 - Debugging

This fixed it for me: in the quick lauch (Ctrl-Q) type "ResetToC#" (or ResetTo something else)

I had the same problem for a long time. In the Debug->Exceptions menu, the "User-unhandled" column was missing! Extremely annoying.

I uninstalled all my plugins, did a reinstall of VS, but nothing worked (Visual Studio probably left some settings on my machine that it reused after reinstalling).

This might not seem like the best solution as there must be some setting somewhere that would have done it as well. I couldn't find it and after not being able to break on user-unhandled exceptions for months, the ResetToC# option was a relief.

Solution 6 - Debugging

I was having the same issue in Visual Studio 2013 on a very large C# project. However if I created a new empty project and threw a test ApplicationException, everything would work as expected and the debugger would break and give me the exception assistant. Doing the same on my existing project would just stop debugging and return to VS editing mode. I noticed in the "Output" window, the last debug trace would show

> The program '[2624] MyApplication.vshost.exe' has exited with code > -1073741819 (0xc0000005) 'Access violation'.

I don't really have the luxury of copying everything into a new project, and none of the suggestions above worked for me. By trial and error I found something that worked: Uncheck the "Unwind the call stack on unhandled exceptions" under Options > Debugging > General > Enable the exception assistant.

By the way, if I manually force the call stack to unwind on this same C# project through the exception assistant (by clicking the "Enable editing" link), the debugger just closes and I can't edit-and-continue. But on a fresh project, it does unwind and edit-and-continue works just fine! So there is a definitely something about my project that VS does not like, but I'll use this as an acceptable workaround for now.

Solution 7 - Debugging

The only thing that worked for me was:

Tools -> Import and Export Settings -> Reset all settings and then reset to C#.

Solution 8 - Debugging

Changing target platform from x64 to x86 helped me

Solution 9 - Debugging

If you have more than one Web Site project in your solution, check that the project you want to debug is active. Right click it and select Set as StartUp Project.

This stumped me for a while since there are no obvious cues that the wrong website is being debugged.

Solution 10 - Debugging

If you hover over your breakpoint and you see the 'No symbols have been loaded warning',

enter image description here

you may need to change your solution configuration from 'Release' to 'Debug'.

enter image description here

Solution 11 - Debugging

The only thing that worked for me was to uncheck "use the new exception helper". Let it catch an exception, stop the program, enable "use the new exception helper" then VS2019 magically started catching unhandled exceptions again.

I still do not have "user-unhandled" anywhere to be found in VS 2019 but at least it works now.

Solution 12 - Debugging

I tried many suggestions here, but finally for me, switching x86/x64 helped me solve the problem of VS debugger terminating without any error or exception.

Screenshot

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBVernonView Question on Stackoverflow
Solution 1 - DebuggingRabolfView Answer on Stackoverflow
Solution 2 - DebuggingTom StudeeView Answer on Stackoverflow
Solution 3 - DebuggingSam HarwellView Answer on Stackoverflow
Solution 4 - DebuggingSamView Answer on Stackoverflow
Solution 5 - DebuggingMatthijs WesselsView Answer on Stackoverflow
Solution 6 - DebuggingNate AView Answer on Stackoverflow
Solution 7 - DebuggingmclaassenView Answer on Stackoverflow
Solution 8 - DebuggingLevon HovhannisyanView Answer on Stackoverflow
Solution 9 - Debuggingmm201View Answer on Stackoverflow
Solution 10 - DebuggingDavid SopkoView Answer on Stackoverflow
Solution 11 - DebuggingrollschView Answer on Stackoverflow
Solution 12 - Debugginguser3405291View Answer on Stackoverflow