[Mono-bugs] [Bug 349194] Type.IsAssignableFrom fails for some dynamically emitted types

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Dec 17 12:20:33 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=349194

User cedricv at neonux.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=349194#c1


Cedric Vivier <cedricv at neonux.com> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |cedricv at neonux.com




--- Comment #1 from Cedric Vivier <cedricv at neonux.com>  2007-12-17 10:20:32 MST ---
The problem is actually that the dynamic type created returns System.MonoType
instead of the actual dynamic type.
Here is a simpler testcase narrowing the problem :


using System;
using System.Reflection;
using System.Reflection.Emit;

public class DynamicTypeTestcase
{
        public static void Main()
        {
                AssemblyName an = new AssemblyName();
                an.Name = "TestAssembly";

                AssemblyBuilder ab =
AppDomain.CurrentDomain.DefineDynamicAssembly(an,
AssemblyBuilderAccess.RunAndSave);

                ModuleBuilder mb = ab.DefineDynamicModule("TestModule",
"Test.dll");
                TypeBuilder tb = mb.DefineType("TestType",
TypeAttributes.Class);
                Type t = tb.CreateType();

                Console.WriteLine(t.GetType());//=> System.MonoType ...but
should be TestType
                Console.WriteLine(t.UnderlyingSystemType);//=> TestType ...but
should be System.MonoType ??
        }
}


-- 
Configure bugmail: https://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.


More information about the mono-bugs mailing list