[Mono-bugs] [Bug 649017] New: castclass emit does not work woth nested types
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Oct 25 11:13:16 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=649017
https://bugzilla.novell.com/show_bug.cgi?id=649017#c0
Summary: castclass emit does not work woth nested types
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.Castclass, nested);
ilgen.Emit (OpCodes.Pop);
ilgen.Emit (OpCodes.Ret);
var baked = myType.CreateType ();
nested.CreateType ();
asmbuild.Save ("sre.exe");
return;
}
}
the expected
castclass class Sample/'nested'<!0>
actual
castclass Sample/nested
--
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