Common Language Runtime detected an invalid program?

I keep repeating this error in my program.

I tried the following:

  • Restart Visual Studio
  • Cleaning and restoration.

When I go through the code line by line, it ceases to completely confuse me with a method call:

GenerateWorksheetPart1Content(WorksheetPart worksheetPart1) 

I do not understand why he stops. The parameter is not equal to zero at the point. What can cause an error?

+2
source share
2 answers

MSDN - InvalidProgramException

Excerpts:

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 happens when passing through the code, because since your method is called, it is compiled by JIT. If the JITer compilation is invalid, this exception will be thrown at this point.

+2
source

Try the following -

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

0
source

All Articles