Common Language Runtime detected an invalid program?

本秂侑毒 提交于 2019-11-28 09:00:13

问题


I have this error repeating continuously in my program.

I have tried the following:

  1. Restart Visual Studio
  2. Clean and Rebuild Solution

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?


回答1:


MSDN - InvalidProgramException

Excerpt:

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.

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.




回答2:


Try following-

1) Delete temporary asp.net files from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
2) Recompile the assemblies and update the corresponding referenses



来源:https://stackoverflow.com/questions/17267592/common-language-runtime-detected-an-invalid-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!