In Visual Studio
, you can use Exception Settings Window
to manage the exceptions – for which exception to break, at which point to break, to add or deleting exceptions. The Exception Settings
windows for Visual Studio is there for quite some time. You can open the exception settings window by navigating from Debug
-> Exception Settings
. With Visual Studio 2017
, it has some additional features and which is quite useful. You can now set the condition on the exception
in the Exception settings Windows. With that, only when there is a matched condition, IDE will throw an exception.
Navigate to Exception Settings Windows, and select then select the corresponding exception types for which you want to apply the condition. Then choose the Edit Condition icon from the tool bar
Inside Edition Conditions window, provide the modules names for only which you want to raise the exception. Currently, it’s only allowed for Modules.
Exception Condition Settings
Once the condition is applied, you can see the same within your conditions column.
Exception Condition Applied
With that when the code is running, Visual Studio will only throw CLR exception based on the applied condition. You can also add multiple conditions, and can only use this for Modules for now – either equal or not equal as condition.
This feature is handy when you want to exclude some of the libraries knows issues ( you may know they are under development ), or some third-party libraries.
Hope this helps.