In this blog post, I am going to share a quite interesting tips, where you can customize the “Exception Assistant” in Visual Studio. As an example, I have shown how we can set some favorite blogs urls in troubleshooting tips section.
Well, Let’s start with bit background to get an clear idea. We all knows that Visual Studio have very smart exception handler that helps us to provides many information to troubleshoots. Whenever an exception raised in Visual Studio, a dialog window appears which called as “Exception Assistant”. This dialog displays what type of exception it is, what are the different Action you can take and also troubleshoot tips.
By default “Exception Assistant” is enabled, If you can configure it by navigating “Tools > Options > Debugging > Enable the Exception Assistant”.
If it’s disabled, on raised of any exception, you will get below exception message window for every exception.
To know more about Exception Assistant, please read this blog post The Exception Assistant .
Now, come back to actual topic of discussion, How we can customize the things that are seeing in "Exception Assistant” window. Yes, all the information that are displayed in exception assistant actually fetched from an XML (DefaultContent.XML ) file which stored at C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ExceptionAssistantContent\1033”.
If you open that XML File, in any editor, you will see content are very simple. You have to provide the Exception Type and Tips details.
As you can see, Exception types are given as “*” which means, this Tips will show for any kind of exception. But, if you want to get some information link based on the Exception Type, you to specify the exception type.
When It Is Very Useful?
This will be very much useful when you are creating any custom exception class and you want to provide your custom information.
Summary
In this post, I have explained how we can customize the Exception Assistant window and how we can set custom help url for custom exception class.
Hope this will help !
Thanks !
AJ
Filed under: Tips and Tricks, Visual Studio