[Mono-bugs] [Bug 476266] New: Generics cause NotImplementedException in Mono.CSharp.AnonymousMethodStorey.MutateArrayType

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Feb 16 13:37:24 EST 2009


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


           Summary: Generics cause NotImplementedException in
                    Mono.CSharp.AnonymousMethodStorey.MutateArrayType
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: khester at pacificbiosciences.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.5)
Gecko/2008121622 Ubuntu/8.04 (hardy) Firefox/3.0.5

I have a bit of C# code that works with the MS C# compiler, but fails on gmcs
2.4.  See below for a stacktrace (with debug line #s).

This failure occurs during compilation and there is a NotImplementedException
intentially thrown from anonymous.cs, line 578.  Here's the context:

        protected Type MutateArrayType (Type array)
        {
            int rank = array.GetArrayRank ();
            Type element = TypeManager.GetElementType (array);
            if (element.IsArray)
                throw new NotImplementedException (); *** THROWS ***

            if (TypeManager.IsGenericParameter (element)) {
                element = MutateGenericArgument (element);
            } else if (TypeManager.IsGenericType (element)) {
                element = MutateGenericType (element);
            } else {
                return array;
            }

            return element.MakeArrayType (rank);
        }

I can extract an example program that shows this problem, but seeing that
someone put in a NotImplemented, I suspect the maintainer already knows that
this is an area to be addressed.  I'm recording this bug to show that this
missing implementation is causing gmcs to fail for 'real world' C# code that
the MS compiler handles properly.

If you can update this bug with the desired behavior for cases when arrays
contain arrays, I can try my hand at adding this behavior and testing.

Failing that, perhaps you can provide some guidance on when you intend to
support generics.

Reproducible: Always

Steps to Reproduce:
1. Compile code containing generics (see details, if you don't already have a
test case that shows this problem I can make one - but didn't want to spend the
time if you already know about this bug)
2. gmcs throws not implemented
Actual Results:  
NotImplementedException thrown by compiler

Expected Results:  
Compile normally

Stack trace:


Unhandled Exception: System.NotImplementedException: The requested feature is
not implemented.
  at Mono.CSharp.AnonymousMethodStorey.MutateArrayType (System.Type array)
[0x00059] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/anonymous.cs:578 
  at Mono.CSharp.AnonymousMethodStorey.MutateType (System.Type type) [0x00031]
in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/anonymous.cs:495 
  at Mono.CSharp.Block.MutateVariables (Mono.CSharp.AnonymousMethodStorey
storey) [0x0002d] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/statement.cs:2371 
  at Mono.CSharp.Block.MutateHoistedGenericType
(Mono.CSharp.AnonymousMethodStorey storey) [0x00000] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/statement.cs:2356 
  at Mono.CSharp.Block.MutateHoistedGenericType
(Mono.CSharp.AnonymousMethodStorey storey) [0x00073] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/statement.cs:2364 
  at Mono.CSharp.AnonymousExpression+AnonymousMethodMethod.Emit () [0x0004f] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/anonymous.cs:1258 
  at Mono.CSharp.TypeContainer.EmitType () [0x001a7] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/class.cs:2139 
  at Mono.CSharp.AnonymousMethodStorey.EmitType () [0x0012d] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/anonymous.cs:400 
  at Mono.CSharp.TypeContainer.EmitType () [0x002b4] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/class.cs:2160 
  at Mono.CSharp.RootContext.EmitCode () [0x00026] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/rootcontext.cs:338 
  at Mono.CSharp.Driver.Compile () [0x00300] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/driver.cs:1718 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x0002f] in
/home/khester/development/software/nrt/packaging/pacbio-mono-runtime/sources-2.4-1/mono/mcs/mcs/driver.cs:302 
make[1]: *** [bin/Debug//PacBio.Common.Chunk.dll] Error 1

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