[Mono-bugs] [Bug 366400] DynamicMethod hits a "implement me" / "should notbe reached" error
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun Mar 2 07:58:32 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=366400
User gert.driesen at pandora.be added comment
https://bugzilla.novell.com/show_bug.cgi?id=366400#c2
Gert Driesen <gert.driesen at pandora.be> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gert.driesen at pandora.be
Status|RESOLVED |REOPENED
Resolution|FIXED |
--- Comment #2 from Gert Driesen <gert.driesen at pandora.be> 2008-03-02 05:58:32 MST ---
Zoltan, MS does appear to allow callvirt with static methods and before r97095
this also worked on Mono for other cases:
using System;
using System.Reflection;
using System.Reflection.Emit;
class Program
{
public delegate int BodyDelegate ();
static void Main (string [] args)
{
DynamicMethod method = new DynamicMethod ("GetInt", typeof (int),
Type.EmptyTypes, typeof (Program).Module);
ILGenerator generator = method.GetILGenerator ();
MethodInfo parse = typeof (Int32).GetMethod ("Parse",
new Type [] { typeof (string) });
generator.Emit (OpCodes.Ldstr, "555");
generator.EmitCall (OpCodes.Callvirt, parse, null);
generator.Emit (OpCodes.Ret);
BodyDelegate del = (BodyDelegate) method.CreateDelegate (typeof
(BodyDelegate));
Console.WriteLine (del ());
}
}
Note:
I'm not saying our behavior is wrong; it just differs from that of MS.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list