[Mono-bugs] [Bug 389171] New: TypeBuilder.BaseType should not return null for classes

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun May 11 14:24:34 EDT 2008


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: mono-bugs at lists.ximian.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at lists.ximian.com
          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.


More information about the mono-bugs mailing list