Search code examples
c#vb.netexceptionvisual-studio-debugging

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?


Solution

  • 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.