I'm trying to understand why and where an exception is thrown in my C# code. The problem is that all my code is in try-catch blocks, so debugger doesn't stop when it happens. Is there a way to explicitly tell it to stop?
Just use the Ctrl+Alt+E shortcut to bring up the exceptions dialog. There you can select any exceptions for which you'd like Visual Studio to break.
See How to: Break When an Exception is Thrown on MSDN.
To break execution when an exception is thrown
(1) On the Debug menu, click Exceptions.
Note If the Exceptions command does not appear on the Debug menu, you can add it. For more information, see To add the Exceptions command to the Debug menu.
(2)
In the Exceptions dialog box, select Thrown for an entire category of exceptions, for example, Common Language Runtime Exceptions.
-or-
Expand the node for a category of exceptions, for example, Common Language Runtime Exceptions, and select Thrown for a specific exception within that category.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With