4

使用 Visual Studio 2012 Express,我如何检查InnerExceptionSystem.TypeInitializationException外部代码框架引发的时间。调试器由于异常而中断,但在任何代码行都没有。它给出以下消息:

No Source Available
The call stack contains only external code.
Thi thread is stopped with only external code frames on the call stack. External code frames are typically from framework code but can also include other optimized modules which are loaded in the target process.

然后给出调用栈,见下图:

在此处输入图像描述

我会设置一个 try-catch 块,但我不知道这发生在代码的哪个位置。此时我该如何检查InnerException?有没有其他方法可以找到发生了什么?

4

1 回答 1

1

此类异常的重现代码,其中堆栈跟踪看起来与您的完全一样:

class Program {
    static Program() {
        throw new Exception("kaboom");
    }
    static void Main(string[] args) {
    }
}

您应该使用抛出异常时弹出的异常助手。点击“查看详情”:

在此处输入图像描述

于 2013-12-06T19:15:53.157 回答