Instability in .NET Virtual Machine and possible security threat. - by Adam_Bienias

Status : 

  Deferred<br /><br />
		The product team has reviewed this issue and has deferred it for consideration at a later time.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 787278 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 5/20/2013 5:26:25 PM
Access Restriction Public


There's a stability issue in a .NET dynamically generated code. I've attached a small project generating 1 new type with 1 field and 1 method. Placing a breakpoint in ClassField.Initialize method, and trying evaluate in Debug Watch window "this" pointer will result in an error "Cannot obtain value of local or argument '<this>'". In a much larger project if ClassField.Initialize contains plenty of code allocating objects in memory, it will cause whole program to crash after a random period of time in a totaly random places (perhaps Garbage Collector is messing up memory).

The program actually contains a bug which causes this behaviour. In a generated code, there's an Opcode "LDFLDA", instead of "LDFLD". Changing to "LDFLD" fixes the problem, however VM should detect this during method generation to avoid any future instability.
Sign in to post a comment.
Posted by Microsoft on 7/2/2013 at 3:06 PM
Thank you for reporting this issue and using Visual Studio 2012. We'll consider this for a future release of Visual Studio while prioritizing it against other bugs with customer feedback.

If you are interested in adding a verifier into your code the Dynamic Method class documentation has some information in it under the Verification section ( If the verifier is turned on for the code attached then you would see an exception thrown “System.Security.VerificationException: Operation could destabilize the runtime”.

Carl Brochu | Visual Studio Team
Posted by Microsoft on 5/23/2013 at 10:58 PM
Thanks for your response.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Adam_Bienias on 5/21/2013 at 2:55 PM
I've attached manualy (as Feedback tool was reporting some error while sending) files produced by Feedback Tool. Please note, that crash is from my large project (not the one I've send you) because it's to random to reproduce. Captured crash occured in a GC.Collect() call (see screenshot attached) as "System.ExecutionEngineException".

As an additional note, I was able to reproduce the crash on VS2010 (same .NET 4.5 VM) on a different computer.
Posted by Microsoft on 5/20/2013 at 11:11 PM
Thanks for your feedback. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a dump file and call stack so that we can conduct further research?

Visual Studio now has an extension called Microsoft Visual Studio 2012 Feedback Tool, available on the VS gallery(

The extension allows you to
1. upload files,
2. collect trace and dump files
3. collect steps while you're repro'ing the issue, as well as
4. SQM logs about VS extensions installed
5. System details (in DxDiag output)

Please submit this information to us within 4 business days. We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 5/20/2013 at 5:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(