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


           Summary: TypeBuilder.BaseType should not return null for classes
           Product: Mono: Class Libraries
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


Currently, TypeBuilder.BaseType returns null for classes if no parent is
specified.

We set object as parent in CreateType (causing an extra call to
setup_internal_class), while MS appears to set it immediately.

I tried moving it to the ctor, but that caused bootstrap to fail.

To reproduce, compile and run the following code:

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

class Program
{
  static void Main ()
  {
    AssemblyName aname = new AssemblyName ();
    aname.Name = "lib";

    AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
      aname, AssemblyBuilderAccess.Run,
      AppDomain.CurrentDomain.BaseDirectory);
    ModuleBuilder mb = ab.DefineDynamicModule ("lib.dll");

    TypeBuilder tb = mb.DefineType ("Foo", TypeAttributes.Class, null);
    Console.WriteLine ("Parent NULL? " + (tb.BaseType == null));
  }
}

Expected result:

Parent NULL? False

Actual result:

Parent NULL? True


-- 
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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to