[Mono-bugs] [Bug 648391] New: TypeBuilder.GetConstructor does not check ctor argument
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Oct 21 12:45:54 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=648391
https://bugzilla.novell.com/show_bug.cgi?id=648391#c0
Summary: TypeBuilder.GetConstructor does not check ctor
argument
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
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 = "assemfilename.exe";
AssemblyBuilder asmbuild = System.Threading.Thread.GetDomain ().
DefineDynamicAssembly (asmname,
AssemblyBuilderAccess.RunAndSave);
ModuleBuilder modbuild = asmbuild.DefineDynamicModule ("modulename",
"assemfilename.exe");
TypeBuilder myType = modbuild.DefineType ("Sample",
TypeAttributes.Public);
string[] typeParamNames = { "TFirst" };
GenericTypeParameterBuilder[] typeParams =
myType.DefineGenericParameters (typeParamNames);
var ctor = myType.DefineDefaultConstructor (MethodAttributes.Public);
var ctori = TypeBuilder.GetConstructor (myType.MakeGenericType (typeof
(int)), ctor);
var ctorii = TypeBuilder.GetConstructor (myType.MakeGenericType (typeof
(bool)), ctori);
Console.WriteLine (ctorii);
return;
}
}
NET throws
System.ArgumentException: The specified constructor must be declared on a
generic type definition.
Parameter name: constructor
at System.Reflection.Emit.TypeBuilder.GetConstructor(Type type,
ConstructorIn
fo constructor)
at Program.Main()
Mono
<nothing>
I have not tested it but same issue may exist with TypeBuilder.GetMethod
--
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