[Mono-bugs] [Bug 386419] New: [Regression] Can' t use TypeBuilders with CustomAttributeBuilder anymore

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat May 3 11:17:00 EDT 2008


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


           Summary: [Regression] Can't use TypeBuilders with
                    CustomAttributeBuilder anymore
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rkvinge at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


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


class T {
static void Main ()
{

AppDomain domain;
AssemblyName name;
AssemblyBuilder assembly;
ModuleBuilder module;

TypeBuilder tb;
ConstructorBuilder ctor;
CustomAttributeBuilder cab;

domain = AppDomain.CurrentDomain;
name = new AssemblyName ("test");
assembly = domain.DefineDynamicAssembly (name,
AssemblyBuilderAccess.RunAndSave);
module = assembly.DefineDynamicModule ("module");


tb = module.DefineType ("T");
tb.SetParent (typeof (System.Attribute));

ctor = tb.DefineDefaultConstructor (MethodAttributes.Public);

cab = new CustomAttributeBuilder (ctor, new object [0]);

Console.WriteLine ("SUCCESS");


}
}

Result:
rolf at linux:/mono> gmcs -debug:full test.cs && mono --debug test.exe
test.cs(17,24): warning CS0219: The variable `cab' is assigned but its value is
never used
Compilation succeeded - 1 warning(s)

Unhandled Exception: System.NotSupportedException: The type is not yet created.
  at System.Reflection.Emit.ConstructorBuilder.GetParameters () [0x0008a] in
/mono/head/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs:126
  at System.Reflection.Emit.CustomAttributeBuilder.Initialize
(System.Reflection.ConstructorInfo con, System.Object[] constructorArgs,
System.Reflection.PropertyInfo[] namedProperties, System.Object[]
propertyValues, System.Reflection.FieldInfo[] namedFields, System.Object[]
fieldValues) [0x0036a] in
/mono/head/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs:170
  at System.Reflection.Emit.CustomAttributeBuilder..ctor
(System.Reflection.ConstructorInfo con, System.Object[] constructorArgs)
[0x00006] in
/mono/head/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs:69
  at T.Main () [0x0004e] in /mono/test.cs:30

MS shows:
Z:>text.exe
SUCCESS

Marked as Major given that this is currently preventing vbnc from
bootstrapping.


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