Quick Tip: Finding hidden exceptions in your .NET application

by Michael O'Hearn on January 4, 2009

Using exceptions to control program flow is a hotly debated subject. Wherever you stand, remember that there are performance implications. It doesn’t hurt to be aware of when exceptions are being thrown. Sometimes they can sneak right by without you ever having seen it.

Have you ever come across an empty catch block? Or one that does nothing useful with the exception and does not rethrow? Luckily, Visual Studio has a setting that can help ensure these don’t slip by. In the Debug->Exceptions menu item is the following dialog:

Exceptions Dialog

After checking the Thrown column for Common Language Runtime Exceptions, your debugger will break for any exception, even if it has been handled.

{ 1 trackback }

DotNetKicks.com
01.07.09 at 6:25 am

{ 5 comments… read them below or add one }

Taddea 02.06.09 at 8:03 am

Fantastic post!!! Cheers!

Nicolosa 02.07.09 at 4:17 am

Your blog is interesting! Keep up the good work!

dragialry 02.24.09 at 2:03 am

Thank you!

clefdwels 03.01.09 at 8:35 pm

Thank you!

ArianaKape 05.13.09 at 4:18 pm

thans for the tip

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>