如何在 Visual Studio 2010 中获得更有用的异常输出?

发布于 2024-12-15 05:05:14 字数 584 浏览 0 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文