Visual studio used to have a specific checkbox to \"Break on Un-handled exception\". In 2015 this has been removed (or moved somewhere I cannot find it). So now my convert
I had the same issue and I managed to solve this by doing this -
That's it!
I was inspired this post since I am using a x64 version of Windows.
Try following the instructions:
https://msdn.microsoft.com/en-us/library/x85tt0dd.aspx
There's definitely some bug in Visual Studio that can cause it to get stuck requiring a restart. Even VS2015.
I had a single threaded situation where a NullReferenceException
was getting caught by an 'outer' handler (still in my code) even though I asked for it to break when it was raised.
I realize this is a 'handled' exception and you're talking an 'unhandled' one - however I'm pretty sure that sometimes a quick restart of VS will fix this, if IISRESET doesn't.
There's a new window called "Exception Settings" that appears in the lower right pane by default when you begin debugging. It has all of the options you would expect.
You can bring it up with CTRL+ALT+E
This allows you to cherry-pick which exceptions cause a break in the debugger.
The key, though, is that you can also set whether these exceptions always break, or only break when it's an unhandled exception -- but setting this is not very intuitive.
You will need to first check "Enable Just My Code" under Tools > Options > Debugging.
This then allows you to right-click the column header (Break When Thrown) in the new Exceptions Settings window, and add the "Additional Actions" column, which then allows you to set each exception as "Continue when unhandled in user code".
So just right-click an exception or an entire group and disable the "Continue when unhandled in user code" flag. Unfortunately, the "Additional Actions" column will show up empty which is the same as "Break when unhandled in user code".
http://blogs.msdn.com/b/visualstudioalm/archive/2015/02/23/the-new-exception-settings-window-in-visual-studio-2015.aspx
For googler that wants to break only when the exception concerns their code, there is an option in Visual Studio 2015: Options->Debugging->General->Just My Code. Once checked, it allow to do not break when the exception is managed (thrown and catched) outside your code.
When I upgraded to VS2015, I also had issues where exceptions used to "break" the application, but are now ignored and passed right over. There are times when we want our code to intentionally throw exceptions in places where we want the code to stop, rather than continue. We always use the phrase Throw New Exception("Message")
to get our code to intentionally break:
If SomethingReallyBad = True Then
Throw New Exception("Something Really Bad happened and we cannot continue.")
End If
With VS2015, the classic "System.Exception" is what is thrown when we say Throw New Exception
. Therefore, we needed to check the "System.Exception" tick in the new Exception Settings:
Check the System.Exception Box
Once checked, our code did as expected.