Reputation: 3787
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.
Upvotes: 66
Views: 54801
Reputation: 7987
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.
Upvotes: 1
Reputation: 2780
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.
Upvotes: 1
Reputation: 5663
If you hover over your breakpoint and you see the 'No symbols have been loaded warning',
you may need to change your solution configuration from 'Release' to 'Debug'.
Upvotes: 1
Reputation: 100019
Depending on the application, the following options may help you:
Tools → Options... → Debugging → General
[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...]
Upvotes: 27
Reputation: 553
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.
Upvotes: 1
Reputation: 3191
For visual studio 2015 :
1.Open Exception settings window (it's new in 2015)
3.If you don't need visual studio to throw specific exceptions uncheck this
Upvotes: 60
Reputation: 5138
The only thing that worked for me was:
Tools -> Import and Export Settings -> Reset all settings and then reset to C#.
Upvotes: 4
Reputation: 42437
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.
Upvotes: 23
Reputation: 71
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.
Upvotes: 4
Reputation: 6739
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.
Upvotes: 4
Reputation: 10452
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..
Upvotes: 40