http://bugzilla.novell.com/show_bug.cgi?id=565127
http://bugzilla.novell.com/show_bug.cgi?id=565127#c0 Summary: GetGenericParameterConstraints fails on methods in dynamic modules Classification: Mono Product: Mono: Runtime Version: 2.6.x Platform: x86 OS/Version: Windows 7 Status: NEW Severity: Normal Priority: P5 - None Component: generics AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- Created an attachment (id=332911) --> (http://bugzilla.novell.com/attachment.cgi?id=332911) Compiled code User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; MALC) using System; using System.Reflection; using System.Reflection.Emit; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var ab = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("foo"), AssemblyBuilderAccess.Run); var modb = ab.DefineDynamicModule("foo"); var tb = modb.DefineType("C", TypeAttributes.Class | TypeAttributes.Public); var mb = tb.DefineMethod("m", MethodAttributes.Public | MethodAttributes.Static); var gps = mb.DefineGenericParameters("T"); mb.SetParameters(gps); mb.SetReturnType(typeof(void)); var il = mb.GetILGenerator(); il.Emit(OpCodes.Ret); var ti = tb.CreateType(); var mi = ti.GetMethod("m"); var mii = mi.MakeGenericMethod(typeof(int)); foreach (var t in mii.GetGenericMethodDefinition().GetParameters()) { Console.WriteLine(t); foreach (var c in t.ParameterType.GetGenericParameterConstraints()) { Console.WriteLine(c); } } } } } Reproducible: Always Steps to Reproduce: 1. compile and run the code above or run the attached .exe Actual Results: Crash: Unhandled Exception: System.InvalidOperationException: Operation is not valid due to the current state of the object at System.Reflection.Emit.GenericTypeParameterBuilder.GetGenericParameterConstraints () [0x00000] in <filename unknown >:0 at ConsoleApplication1.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 Expected Results: T -- Configure bugmail: http://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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
