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

User [EMAIL PROTECTED] added comment
https://bugzilla.novell.com/show_bug.cgi?id=354047#c6


Rodrigo Kumpera <[EMAIL PROTECTED]> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
             Status|NEW                                             |ASSIGNED




--- Comment #6 from Rodrigo Kumpera <[EMAIL PROTECTED]>  2008-05-08 13:39:19 
MST ---
The issue here is that the generic params on the created type are owned by the
TypeBuilder. This is another issue with our implementation. Take the following
program:


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

public class Tests
{
        public static void Main (String[] args) {
                AssemblyName assemblyName = new AssemblyName ();
                assemblyName.Name = "foo";

                AssemblyBuilder assembly =
                        Thread.GetDomain ().DefineDynamicAssembly (
                                        assemblyName,
AssemblyBuilderAccess.RunAndSave);

                ModuleBuilder module = assembly.DefineDynamicModule ("foo");

                TypeBuilder tb = module.DefineType ("Foo",
TypeAttributes.Public);
                GenericTypeParameterBuilder[] typeParams =
tb.DefineGenericParameters (new String[] { "T" });

                Type t = tb.CreateType ();

                Type inst = tb.MakeGenericType (typeParams [0]);

                Console.WriteLine ("inst is gtd {0}",
inst.IsGenericTypeDefinition);
                Console.WriteLine ("tb == created type {0} ", tb == t);
                Console.WriteLine ("tb arg == created type arg
{0}",tb.GetGenericArguments()[0] == t.GetGenericArguments()[0]);

                                Console.WriteLine ("tb owns params {0}",
tb.GetGenericArguments()[0].DeclaringType == tb);
                                Console.WriteLine ("res owns params {0}",
t.GetGenericArguments()[0].DeclaringType == t);

        }
}



On MS it prints:
inst is gtd False
tb == created type False
tb arg == created type arg False
tb owns params True
res owns params True

On mono HEAD it prints:
inst is gtd True
tb == created type False 
tb arg == created type arg True
tb owns params True
res owns params False


As you can see the issue is that the generic arguments are shared when they
shouldn't.


-- 
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

Reply via email to