Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the exception messages in Vs2012?

For a bit of a joke (about 6 months ago), I changed the exceptions file on a colleagues PC so that when a NullReferenceException was thrown, he would get a funny Trouble Shooting Tip with a reference to him - We have a joke about him chopping up in his basement...

After forgetting about this, and now 6 months on, this error has arisen, whilst yes it's funny, it also needs to be fixed and changed back.

Any ideas how I'd change it back? Or what file it should be? All my googling seems to point to File Exceptions..

(For that wondering how it looked...)enter image description here

like image 663
Stuart.Sklinar Avatar asked Oct 31 '13 11:10

Stuart.Sklinar


People also ask

How to change exception Settings in Visual Studio?

With a solution open in Visual Studio, use Debug > Windows > Exception Settings to open the Exception Settings window.

How do I make Visual Studio not stop on exception?

Note: you can uncheck Break when this exception type is thrown directly in the exception handler and continue debugging (press F5 ). Visual Studio will add this exception type to the Exception settings and will remember that it shouldn't break on this exception again.


1 Answers

The file containing the custom troubleshooting tips for VS2012 is:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ExceptionAssistantContent\1033\DefaultContent.xml

This is what the NullReferenceException block should look like:

<Exception>
    <Type>System.NullReferenceException</Type>
    <Tip HelpID="EHNullReference">
        <Description>Use the "new" keyword to create an object instance.</Description>
    </Tip>
</Exception>
<Exception>
    <Type>System.NullReferenceException</Type>
    <Tip HelpID="EHNullReference">
    <Description>Check to determine if the object is null before calling the method.</Description>
    </Tip>
</Exception>

Kudos for the prank, I'll have to remember that one!

like image 91
Chris Pickford Avatar answered Oct 13 '22 13:10

Chris Pickford