title: Error while trying to call method
body: <p>I have this code:</p>
  
  <pre><code>var work = new DynamicMethod("work", null, Type.EmptyTypes);
              var il = work.GetILGenerator();
              il.Emit(OpCodes.Ldstr, "a");
              il.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine", new Type[]{typeof(string)}));
              var d = (Action)work.CreateDelegate(typeof(Action));
              d();
  </code></pre>
  
  <p>I'm just trying to create new method via System.Reflection.Emit. But it throws me this error:</p>
  
  <pre><code>Common Language Runtime detected an invalid program.
  </code></pre>
  
  <p>Does anybody know how must I repair it to working or where's error? Please help.</p>