[Mono-bugs] [Bug 708408] New: Compiler crashes when compiling a generic class which refers it's nested class

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 26 13:00:04 EDT 2011


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

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


           Summary: Compiler crashes when compiling a generic class which
                    refers it's nested class
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.10.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: C#
        AssignedTo: michael.miller at suse.com
        ReportedBy: keks9n at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.9.168
Version/11.50

I've tried to compile my project using the compiler from Mono and got this
exception:

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at Mono.CSharp.TypeParameterInflator.Inflate (Mono.CSharp.TypeSpec type)
[0x00000] in <filename unknown>:0 
  at Mono.CSharp.InflatedTypeSpec.InitializeMemberCache (Boolean onlyTypes)
[0x00000] in <filename unknown>:0 
  at Mono.CSharp.InflatedTypeSpec.get_BaseType () [0x00000] in <filename
unknown>:0 
  at Mono.CSharp.MemberAccess.ResolveNamespaceOrType (IMemberContext rc,
Boolean silent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MemberAccess.ResolveAsTypeStep (IMemberContext ec, Boolean
silent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Expression.ResolveAsTypeTerminal (IMemberContext ec, Boolean
silent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeArguments.Resolve (IMemberContext ec) [0x00000] in
<filename unknown>:0 
  at Mono.CSharp.GenericTypeExpr.DoResolveAsTypeStep (IMemberContext ec)
[0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeExpr.ResolveAsTypeStep (IMemberContext ec, Boolean silent)
[0x00000] in <filename unknown>:0 
  at Mono.CSharp.MemberAccess.ResolveNamespaceOrType (IMemberContext rc,
Boolean silent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MemberAccess.ResolveAsTypeStep (IMemberContext ec, Boolean
silent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Expression.ResolveAsTypeTerminal (IMemberContext ec, Boolean
silent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.ResolveBaseTypes (Mono.CSharp.TypeExpr&
base_class) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Class.ResolveBaseTypes (Mono.CSharp.TypeExpr& base_class)
[0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.DefineBaseTypes () [0x00000] in <filename
unknown>:0 
  at Mono.CSharp.TypeContainer.DefineType () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ModuleContainer.Define () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename
unknown>:0 


After some investigation I've realized that the problem is related to handling
generics with nested types.

For example try to compile this code:

namespace Lol
{
        public class Foo<T>:System.Collections.Generic.List<Foo<T>.Bar>
        {
                class Bar
                {
                }
        }
}


Reproducible: Always

Steps to Reproduce:
1. Create a .cs file that contains something like that:
namespace Lol
{
        public class Foo<T>:System.Collections.Generic.List<Foo<T>.Bar>
        {
                class Bar
                {
                }
        }
}
2. Try to compile it using Mono C# Compiler
Actual Results:  
It crashes!

Expected Results:  
I've expected that it would compile it fine just like the compiler from MS VS
does.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list