Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make visual studio break only on unhandled exceptions?

On my other machines, Visual Studio always broke on errors when there was not a try/catch to handle them, but if there was a try/catch then it didn't break.

For some reason, on this laptop, it doesn't work that way. It didn't break at all at first, but then I found out how to set it to break by going to debug/exceptions. However, configuring it to break there causes it to always break on exceptions even if there is a try/catch block.

How do I make it work like I'm used to?

like image 581
Brandon Moore Avatar asked Jun 25 '12 03:06

Brandon Moore


People also ask

How do I create a break on exception in Visual Studio?

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.

How do I stop an exception in Visual Studio?

Since Visual Studio 2015 you control which Exceptions to stop on in the Exception Settings Window (Debug->Windows->Exception Settings). The shortcut is still Ctrl - Alt - E .

How do I disable just my code in Visual Studio?

To enable or disable Just My Code in Visual Studio, under Tools > Options (or Debug > Options) > Debugging > General, select or deselect Enable Just My Code.

How do I add a break in Visual Studio?

Set a breakpoint in the Disassembly windowIn the Disassembly window, click in the left margin of the instruction you want to break at. You can also select it and press F9, or right-click and select Breakpoint > Insert Breakpoint.


1 Answers

Make sure you have Just My Code Enabled by going into Tools-->Options-->Debugger-->General--> Enable Just My Code. This will change your Debug--> Exceptions Dialog Box to show a CheckBox for User-unhandled Errors.

enter image description here

like image 173
Mark Hall Avatar answered Oct 07 '22 04:10

Mark Hall