Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force break on any exception thrown in program

When coding in C# I like not to handle exceptions because it makes it easier to figure out where and why things went wrong. However, I can't give anyone a program that doesn't handle exceptions.

Can I somehow force Visual Studio to break on every exception, including those thrown inside try/catch blocks?

like image 914
hsprogrammer Avatar asked Nov 08 '09 22:11

hsprogrammer


People also ask

How do you break an exception thrown?

Tell the debugger to break when an exception is thrownIn the Exception Settings window (Debug > Windows > Exception Settings), expand the node for a category of exceptions, such as Common Language Runtime Exceptions. Then select the check box for a specific exception within that category, such as System.


1 Answers

VS2015 and later: Go into Debug > Windows > Exception Settings and check the tick box against Common Language Runtime Exceptions (below the 'Break When Thrown' column header).

VS2013 and earlier: Go into Debug > Exceptions and check the Thrown box against Common Language Runtime Exceptions.

You may get a lot of noise this way though, as this will also break on exceptions thrown in libraries or inside the framework itself.

like image 70
itowlson Avatar answered Sep 20 '22 05:09

itowlson