Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Last week, I talked about what first chance exceptions are and mentioned that you could configure the Visual Studio debugger to allow you to debug them.
Using Visual Studio .NET 2003, you can configure how the debugger handles first chance exceptions on a per exception basis or for exception families (by namespace and/or runtime).
Here's how you enable a specific exception to be caught. I will use System.ApplicationException in this example.
Typically, the default value for "when the exception is thrown" (aka first chance exceptions) is "Continue".
To enable an exception family is just as easy. This example will enable stopping on first chance exceptions for exceptions defined in the System.Net namespace.
Note: When enabling for an exception family, specific exception settings override the family level setting. If you are not catching the desired exception, check the configuration for the exception using the first set of steps above. Change the option to "Use parent setting" and the specific exception will inherit the family setting.
As mentioned in last week's post, if your code does not handle the exception, the debugger will typically stop with an unhandled exception and allow you to debug where you failed to catch. Using today's tip, you can debug at the point of the throw and examine the conditions which caused the exceptional situation.
Enjoy!
-- DK
Disclaimer(s):
This posting is provided "AS IS" with no warranties, and confers no rights.
Please sign in to use this experience.
Sign in