Common Language Runtime Detected An Invalid Program Visual Studio 2010

Posted by admin

I am getting the following error below from System.Collections.Immutable.1.1.33-beta. I had the same problem when deploying my project (compiled to 4.5 with Visual Studio 2012) to a production IIS server (7). Works flawlessly on my local desktop. InvalidProgramException: Common Language Runtime detected an invalid program.System.Collections.Immutable.SecurePooledObject`1.Use(TCaller& caller) +0System.Collections.Immutable.Enumerator.ResetStack +87System.Collections.Immutable.Enumerator.ctor(Node root, Builder builder, Int32 startIndex, Int32 count, Boolean reversed) +1064System.Collections.Immutable.Node.GetEnumerator +157System.Collections.Immutable.Node.TrueForAll(Predicate`1 match) +101.Upgrading.NET Framework from 4.5.1 to 4.5.2 (via Windows Update) solved the issue for me. The underlying JIT issue has been fixed since at least.NET4.5.2 (and on.NET Core), but we support.NET 4.5 RTM inimmutable collections at this time, so work around it.The SecureObjectPool.IsOwned helper would either not getinlined or trigger InvalidProgramException when forced viaMethodImplOptions.AggressiveInlining.The work around implemented here is to remove the trivialhelper and manually inline it in the source code. I renamedOwner to OwnerPoolUserId in order to make the now repetitivecomparisons read about as well as before IMHO. Before wehad x.IsOwned(ref this) and now we have x.OwnerPoolUserId poolUserId.I left the old helper commented out with a note as to why weno longer use it in case someone is tempted to refactor backbefore we can drop support for older platforms.

  1. Common Language Runtime Detected An Invalid Program D365

The underlying JIT issue has been fixed since at least.NET4.5.2 (and on.NET Core), but we support.NET 4.5 RTM inimmutable collections at this time, so work around it.The SecureObjectPool.IsOwned helper would either not getinlined or trigger InvalidProgramException when forced viaMethodImplOptions.AggressiveInlining.The work around implemented here is to remove the trivialhelper and manually inline it in the source code. I renamedOwner to OwnerPoolUserId in order to make the now repetitivecomparisons read about as well as before IMHO. Before wehad x.IsOwned(ref this) and now we have x.OwnerPoolUserId poolUserId.I left the old helper commented out with a note as to why weno longer use it in case someone is tempted to refactor backbefore we can drop support for older platforms. In.NET 4.5 and.NET 4.5.1 on x64, the JIT would attempt to inline aparticular generic method, which would cause it to bail with anInvalidProgramException.Workaround the issue by applying MethodImplOptions.NoInlining to themethod. There is no perf loss because the whole purpose of this methodis to throw in the failure case and it is factored out precisely tohelp the inlining of its callers.The JIT bug has already been fixed in.NET 4.5.2, but we supportimmutable collections on.NET 4.5 and.NET 4.5.1 as well, which iswhy we must workaround the issue.

Invalid

Common Language Runtime Detected An Invalid Program D365

In.NET 4.5 and.NET 4.5.1 on x64, the JIT would attempt to inline aparticular generic method, which would cause it to bail with anInvalidProgramException.Workaround the issue by applying MethodImplOptions.NoInlining to themethod. There is no perf loss because the whole purpose of this methodis to throw in the failure case and it is factored out precisely tohelp the inlining of its callers.The JIT bug has already been fixed in.NET 4.5.2, but we supportimmutable collections on.NET 4.5 and.NET 4.5.1 as well, which iswhy we must workaround the issue.

When clicking edit on a all products for a site it occurred repeatedly and I could not edit the product. Restarted the site and it went away. Site was running for about a day with no keep alive (would have been asleep for 12 hours).

Prior to the half day inactivity it worked fine. After restart it also works fine.I have a mirror copy of the site running in debug mode which I've never seen this occur on before (though this does have a keep alive)I will idle the site overnight and see what happens tomorrow.