[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


           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,
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");


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
  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
  at System.Reflection.Emit.CustomAttributeBuilder..ctor
(System.Reflection.ConstructorInfo con, System.Object[] constructorArgs)
[0x00006] in
  at T.Main () [0x0004e] in /mono/test.cs:30

MS shows:

Marked as Major given that this is currently preventing vbnc from

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