如何在 Visual Studio 2010 中获得更有用的异常输出?
在 Python 中,如果我遇到异常,我会看到一个非常有用的堆栈跟踪,如下所示:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in c
File "<stdin>", line 2, in b
File "<stdin>", line 3, in a
KeyError: 'so cool'
在 Visual Studio 2010 中,我收到一个弹出窗口,其中提供了与最后一条相当无用的独立消息相同的内容。在这种特殊情况下,TargetInitationException 未得到处理
。所以我必须单击“查看详细信息”,一个小箭头,InnerException“对象引用未设置到对象实例”上的另一个小箭头。最后,我必须将鼠标悬停在 StackTrace 数据部分上,以便我可以看到其他有价值的部分 - 发生异常的行号。
有没有办法让 Visual Studio 向我显示我真正关心的信息,或者我是否必须深入了解有用的信息?
In Python if I hit an exception, I see a nice useful stack trace like this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in c
File "<stdin>", line 2, in b
File "<stdin>", line 3, in a
KeyError: 'so cool'
In Visual Studio 2010, I get a popup that gives me the equivalent of the last, quite useless on-its-own message. In this particular case, TargetInvocationException was unhandled
. So I have to click "view detail", a tiny arrow, another tiny arrow on the InnerException "Object reference not set to an instance of an object". Finally I have to hover over the StackTrace data part so that I can see the part that makes anything else worthwhile - the line number of where the exception occured.
Is there any way to make Visual Studio show me that information that I really care about, or am I stuck having to drill my way down to the useful information?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论