简体   繁体   English

如何在Vs2012中更改异常消息?

[英]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... 开个玩笑(大约六个月前),我在同事的PC上更改了异常文件,这样当抛出NullReferenceException时,他会得到一个有趣的“麻烦射击技巧”,并提及他-我们在开玩笑在他的地下室里砍...

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. 在忘记了这个错误之后(现在是6个月),出现了此错误,虽然是有趣的,但也需要修复并改回它。

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...) (对于那奇怪的样子...) 在此处输入图片说明

The file containing the custom troubleshooting tips for VS2012 is: 包含VS2012的自定义疑难解答提示的文件是:

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

This is what the NullReferenceException block should look like: 这是NullReferenceException块的外观:

<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! 恶作剧的荣誉,我必须记住那个!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM