InvalidProgramException: Common Language Runtime detected an invalid program

Everything,

I am having a problem deploying an ASP.NET 4.0 webpage. Error

System.InvalidProgramException: Common Language Runtime detected an invalid program

The error occurs in IIS7 in a 64-bit Windows Server window. The same page works on IIS7 in my development window (32-bit Windows 7) and in the Visual Studio development environment. I do not know any differences in IIS7 configuration.

I used PEVerify to check the DLL in the bin directory of the application.

I can reproduce the problem using an Entity Framework query to populate a DataGrid.DataSource. This is not a very difficult request.

Any ideas on what could be causing this? My next step is to try to just use the queries.

Thanks for any help.

+4
source share
3 answers

This is similar to a decimal (1,0) type primary key.

+4
source

I think this may be a number of problems. Depending on your Entity Framework model and how large / complex it is, you may run into a JIT compiler limit. This applies to version 2.0, so it can be applied to 4.0.

Assuming you don’t have any huge methods, have you put together an assembly for any processor? If you specified a processor, then a mismatch between 32/64 bits will cause problems. Try again with any processor .

Let me know if this works.

Eric

+1
source

I got the same error in a line of code that has been error free for several months. Fortunately, I was able to return my changes to working condition and repeat the steps. Turns out it was a line of code in the same Task.Run() package that was causing the error. What is scary is that there was nothing wrong with the code: var test = user.objectId.HasValue; but as soon as I delete this line the error disappeared.

  public virtual Task<IList<string>> GetRolesAsync(TUser user) { if (user == null) throw new ArgumentNullException("user"); return Task.Run(() => { var test = user.objectId.HasValue; var userRolesQuery = objectManager.buildQueryByFilter<List<security.UserRole>>("user = '{0}'", user.objectId); objectManager.buildSubquery<TRole>("role", userRolesQuery); var userRoles = objectManager.openByQuery<List<security.UserRole>>(userRolesQuery); return (IList<string>)userRoles.Select(userRole => userRole.role.name).ToList(); }); } 
0
source

All Articles