How to: Break when an exception is thrown.

While helping me to solve a threading issue, Robert mentioned this little gem.  Within Visual Studio, you can set it so that it breaks on all Exceptions (not just the unhandled exceptions). No longer do I need to keep stepping over code to see when an exception was thrown, I can simply bring up the exceptions dialog (ctrl + alt + E, or Debug > Exceptions) and tell it to break when a CLR Exception is thrown!  Now, as soon as an exception is thrown it will break at the point the exception was thrown.  You can then enable editing and see what was actually happening.


I knew it could be done, but had completely forgotten how/where to set it, where to the point I had forgotten it could be done…

Happy debugging!

Technorati Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *