通用语言运行时检测到一个无效的程序?检测到、语言、程序

2023-09-05 23:53:11 作者:马叉虫

我有这样的错误在我的程序不断重复。

I have this error repeating continuously in my program.

我已经试过如下:

在重新启动Visual Studio 清洁并重新生成解决方案

当我通过线code线步骤,它停止让我完全糊涂了,在一个方法调用:

When I step through the code line by line, it stops leaving me totally confused at a method call:

GenerateWorksheetPart1Content(WorksheetPart worksheetPart1)

我不明白为什么它停在那里。该参数不是在点零。这可能是导致该错误?

I don't understand why it stops there. The parameter is not null at the point. What could be causing the error?

推荐答案

MSDN - InvalidProgramException

节选:

当程序包含无效微软所引发的异常 中间语言(MSIL)或元数据。一般来说,这表明 在生成程序的编译器中的错误。

The exception that is thrown when a program contains invalid Microsoft intermediate language (MSIL) or metadata. Generally this indicates a bug in the compiler that generated the program.

这是发生当你在code的一步,因为作为你的方法被调用它正被JIT编译。如果编译由JITer是无效的,这异常会在这一点上被抛出。

This is happening as you step through the code because as your method is called it is being JIT compiled. If the compilation by the JITer is invalid, this exception will be thrown at this point.