https://bugzilla.novell.com/show_bug.cgi?id=649237
https://bugzilla.novell.com/show_bug.cgi?id=649237#c0 Summary: Missing The specified field must be declared on the generic type definition Classification: Mono Product: Mono: Class Libraries Version: SVN Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: CORLIB AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- using System; using System.Reflection; using System.Reflection.Emit; class Program { static void Main () { AssemblyName asmname = new AssemblyName (); asmname.Name = "sre"; AssemblyBuilder asmbuild = System.Threading.Thread.GetDomain ().DefineDynamicAssembly (asmname, AssemblyBuilderAccess.RunAndSave); ModuleBuilder modbuild = asmbuild.DefineDynamicModule ("modulename", "sre.exe"); TypeBuilder myType = modbuild.DefineType ("Sample", TypeAttributes.Public); string[] typeParamNames = { "TFirst" }; myType.DefineGenericParameters (typeParamNames); var nested = myType.DefineNestedType ("nested"); nested.DefineGenericParameters (typeParamNames); var field = myType.DefineField ("field", nested, FieldAttributes.Public); var m = myType.DefineMethod ("test", MethodAttributes.Public); m.SetParameters (myType); var ilgen = m.GetILGenerator (); ilgen.Emit (OpCodes.Ldarg_0); ilgen.Emit (OpCodes.Ldnull); ilgen.Emit (OpCodes.Stfld, TypeBuilder.GetField (myType.MakeGenericType (typeof (int)), field)); ilgen.Emit (OpCodes.Ret); var baked = myType.CreateType (); nested.CreateType (); asmbuild.Save ("sre.exe"); return; } } NET throws System.ArgumentException: The specified field must be declared on the generic type definition of the specified type. Parameter name: type at System.Reflection.Emit.TypeBuilder.GetField(Type type, FieldInfo field) at Program.Main() -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
