How to Stop on First Chance Exceptions - Visual Studio 2005

Yesterday, I talked about how to enable stopping in the debugger on first chance exceptions when using Visual Studio .NET 2003.  Today,  I'm going to cover the same topic using Visual Studio 2005.

Note: Today's post is based on the beta 2 release of Visual Studio 2005.  I will update these steps (in a later post) if they change significantly in the final version.

Like Visual Studio .NET 2003, Visual Studio 2005 allows you to configure exception handling for an individual exception type and for groups of exceptions (ex: by namespace).

To stop on first chance exceptions for a specific exception type (ex: System.ApplicationException), use the steps below.

  • Start Visual Studio 2005 and load (or create) a project
  • On the Debug menu, select Exceptions (or use Ctrl+Alt+E) from the keyboard)
  • Expand the Common Language Runtime Exceptions node in the list
  • Expand the System node
  • Locate the System.ApplicationException entry and check the box under Thrown
  • Click OK

For exception families (ex: System.Net namespace), the steps are very similar.

  • Start Visual Studio 2005 and load (or create) a project
  • On the Debug menu, select Exceptions (or use Ctrl+Alt+E) from the keyboard)
  • Expand the Common Language Runtime Exceptions node in the list
  • Locate the System.Net entry and check the box under Thrown
  • Click OK

One thing to be aware of, changing the options for an exception family (ex: System.IO) will change the setting for all nodes beneath it (ex: System.IO.FileNotFoundException) to match. 

Note:  If you are debugging Smart Device (NetCF) projects using the beta 2 release of Visual Studio 2005, you will need to turn off the debugger's Just-My-Code (JMC) feature to be able to stop on first chance exceptions.

Take care!
-- DK

Disclaimer(s):
This posting is provided "AS IS" with no warranties, and confers no rights.
Some of the information contained within this post may be in relation to beta software. Any and all details are subject to change.