[Mono-bugs] [Bug 648360] New: Cannot compile nested generics under certain circumstances.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 21 11:17:15 EDT 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=648360#c0


           Summary: Cannot compile nested generics under certain
                    circumstances.
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.8.x
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: davidiw at ufl.edu
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User
           Blocker: ---


Description of Problem:
Cannot compile nested generics under certain circumstances.

Using this code piece:

using System.Collections.Generic;

public class Blah<T> {
  protected class WrapperWrapper<c> {
    public readonly Wrapper<c> Wrapper;

    public WrapperWrapper() : this(Wrapper<c>.Empty)
    {
    }

    protected WrapperWrapper(Wrapper<c> val)
    {
      Wrapper = val;
    }

    public WrapperWrapper<c> NewWrapperWrapper(Wrapper<c> val)
    {
      return new WrapperWrapper<c>(val);
    }
  }
}

public class Wrapper<c> {
  public static Wrapper<c> Empty = new Wrapper<c>(default(c));
}

GMCS produces this exception:

mono_image_get_ctor_on_inst_token: don't know how to handle
System.Reflection.Emit.ConstructorOnTypeBuilderInst
Stacktrace:

  at (wrapper managed-to-native) System.Reflection.Emit.ModuleBuilder.getToken
(System.Reflection.Emit.ModuleBuilder,object) <0x0004c>
  at (wrapper managed-to-native) System.Reflection.Emit.ModuleBuilder.getToken
(System.Reflection.Emit.ModuleBuilder,object) <0x0004c>

If we remove the NewWrapperWrapper method, the public constructor
WrapperWrapper(), or move WrapperWrapper to a top level public class, it
compiles fine.

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