Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 检查外部代码框架引发的System.TypeInitializationException中的InnerException_C#_Visual Studio 2012_Inner Exception - Fatal编程技术网

C# 检查外部代码框架引发的System.TypeInitializationException中的InnerException

C# 检查外部代码框架引发的System.TypeInitializationException中的InnerException,c#,visual-studio-2012,inner-exception,C#,Visual Studio 2012,Inner Exception,使用Visual Studio 2012 Express,当从外部代码帧引发System.TypeInitializationException时,如何检查内部异常。调试器会因异常而中断,但不会在任何代码行中断。它给出了以下信息: No Source Available The call stack contains only external code. Thi thread is stopped with only external code frames on the call stack

使用Visual Studio 2012 Express,当从外部代码帧引发
System.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
?是否有其他方法来查找问题?

在堆栈跟踪与您的完全相同的情况下,为此类异常重新编写代码:

class Program {
    static Program() {
        throw new Exception("kaboom");
    }
    static void Main(string[] args) {
    }
}
您应该使用抛出异常时弹出的异常助手。单击“查看详细信息”:


查看“局部变量”窗口。您可以尝试缩小问题范围,在您认为问题发生的位置插入多个try-catch,在所有catch处设置断点,然后运行应用程序。当它断裂时,试着减小试扣的大小,然后再试一次。@SLaks,为什么?整个堆栈包含OP尚未编写的代码。@maxmomersteeg对于大型多线程代码来说,这是不现实的base@Jonathan我不知道,你的申请有那么大。没有例外的助手出现在我面前。这可能是因为我使用的是VS12 Express吗?不知道。工具+选项、调试、常规,确保选中“启用异常助手”选项。