[Mono-bugs] [Bug 473298] New: MonoReflectionGenericParam unmanaged shadow object is not kept in sync with GenericParameterBuilder

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Feb 6 08:46:35 EST 2009


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


           Summary: MonoReflectionGenericParam unmanaged shadow object is
                    not kept in sync with GenericParameterBuilder
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: lunchtimemama at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


When a GenericParameterBuilder is made ready for use, the unmanaged structure
does not have the attribute flags or constraint information.

Test Case:

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

class Test
{
    public static void Main(string[] args)
    {
        // Set up our assembly and module
        var assembly_name = new AssemblyName("VarianceTest");
        var assembly_definition =
AppDomain.CurrentDomain.DefineDynamicAssembly(
            assembly_name, AssemblyBuilderAccess.Run);
        var module_builder = 
assembly_definition.DefineDynamicModule(assembly_name.Name);

        // Define our covariant generic interface
        var interface_type_builder = module_builder.DefineType (
            "IFoo`1", TypeAttributes.Interface | TypeAttributes.Public |
TypeAttributes.AutoClass |
            TypeAttributes.Abstract | TypeAttributes.AnsiClass);
        var generic_parameter_builders =
interface_type_builder.DefineGenericParameters ("T");
        generic_parameter_builders[0].SetGenericParameterAttributes (
            GenericParameterAttributes.DefaultConstructorConstraint);
        var interface_type = interface_type_builder.CreateType ();

        Console.WriteLine (interface_type.GetGenericArguments
()[0].GenericParameterAttributes);
    }
}

Expected Result:
It should print "DefaultConstructorConstraint"

Actual Result:
It prints "None"

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