[Mono-bugs] [Bug 648616] New: Nested generic type field type is emitted incorrectly
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Oct 22 08:49:30 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=648616
https://bugzilla.novell.com/show_bug.cgi?id=648616#c0
Summary: Nested generic type field type is emitted incorrectly
Classification: Mono
Product: Mono: Runtime
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Major
Priority: P5 - None
Component: misc
AssignedTo: rkumpera at novell.com
ReportedBy: msafar at novell.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
Compile & run
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.Ldfld, field);
ilgen.Emit (OpCodes.Pop);
ilgen.Emit (OpCodes.Ret);
var baked = myType.CreateType ();
nested.CreateType ();
asmbuild.Save ("sre.exe");
return;
}
}
Disassembly produced sre.exe
Mono emits invalid
IL_0001: ldfld class Sample/'nested' class Sample<!TFirst>::'field'
NET
IL_0001: ldfld class Sample/'nested'<!0> class Sample<!TFirst>::'field'
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list