Exception Settings has been a powerful feature in Visual Studio for quite some time now. It has got some extra fire-power with new Exception Helper dialog in Visual Studio 2017. Let’s say, your code is using a third party library that is throwing an exception. Let’s also say that this exception is of not much interest to you when it's raised by that third party library. Otherwise, you would like your debugger to break every time that same exception is thrown. Let me show how you can accomplish this with Visual Studio 2017.
Let’s say your solution has a dependency on a third party library for Video Streaming.
When using this library, it's throwing an exception that’s interfering with your debugging experience. In general, you would like your debugger to break on the exception, however, you don’t want the same behaviour when exception is thrown from this VideoStreaming
library. With Visual Studio 2017, you can set a condition for this Exception to break except when it's thrown from VideoStreaming.dll as shown in the image below:
If this check-box for VideoStreaming.dll is checked, it will add a condition in the Exception Settings for this particular type of exception as shown below:
In case you decide to remove this setting, just right click on this condition will bring up the following context-menu.
Select “Edit Conditions” here, which will bring the following pop-up. This dialog provides you with the ability to either modify the condition or remove it entirely.
Until next time, happy debugging.
Filed under: CodeProject, Visual Studio 2017