[Mono-bugs] [Bug 389278] New: EnumConstant. GetTypedValue fails due to weird way Reflection.Emit works with enums

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 12 06:02:11 EDT 2008


           Summary: EnumConstant.GetTypedValue fails due to weird way
                    Reflection.Emit works with enums
           Product: Mono: Compilers
           Version: 1.9.0
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mihailik at gmail.com
         QAContact: mono-bugs at lists.ximian.com
        Depends on: 389276
          Found By: Other

System.Enum.ToObject cannot process TypeBuilders, i.e the case when enum is
created via Reflection.Emit and not existing 'real' enum.

There is a basic workaround in code, but it doesn't work properly under
original .NET 2.0 SP1.

Seems to be a 'by design' problem with original Microsoft .NET 2.0 SP1
Force the workaround to be applied for all enum TypeBuilders as well.
Proposed change in ecore.cs ~1615ln
        public override object GetTypedValue()
            // FIXME: runtime is not ready to work with just emited enums
            if (!RootContext.StdLib 
                || type is TypeBuilder
                return Child.GetValue();

            return System.Enum.ToObject(type, Child.GetValue());

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