[Mono-bugs] [Bug 81019][Wis] New - [GMCS] NRE when partial class derives from generic class with inner class as argument

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Mar 2 22:33:09 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by daniel at hofmannmail.ath.cx.

http://bugzilla.ximian.com/show_bug.cgi?id=81019

--- shadow/81019	2007-03-02 22:33:09.000000000 -0500
+++ shadow/81019.tmp.22282	2007-03-02 22:33:09.000000000 -0500
@@ -0,0 +1,114 @@
+Bug#: 81019
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: daniel at hofmannmail.ath.cx               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] NRE when partial class derives from generic class with inner class as argument
+
+Description of Problem:
+
+The following Code causes gmcs to throw a NullReferenceException
+
+------------------------------------------------------------
+public class Foo<K>
+{
+}
+
+partial class B {
+}
+
+partial class B : Foo<B.C> {
+  
+  public class C {
+  }
+  
+}
+--------------------------------------------------------------
+
+Steps to reproduce the problem:
+1. Compile the above code snippet with gmcs (to a dll)
+"gmcs -target:library file.cs"
+
+Actual Results:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+  at Mono.CSharp.TypeContainer.DefineTypeBuilder () [0x00000]
+  at Mono.CSharp.TypeContainer.DefineType () [0x00000]
+  at Mono.CSharp.Class.DefineType () [0x00000]
+  at Mono.CSharp.TypeContainer.FindMembers_NestedTypes (Int32 modflags,
+BindingFlags bf, System.Reflection.MemberFilter filter, System.Object
+criteria, System.Collections.ArrayList& members) [0x00000]
+  at Mono.CSharp.TypeContainer.FindMembers (MemberTypes mt, BindingFlags
+bf, System.Reflection.MemberFilter filter, System.Object criteria) [0x00000]
+  at Mono.CSharp.TypeManager.MemberLookup_FindMembers (System.Type t,
+MemberTypes mt, BindingFlags bf, System.String name, System.Boolean&
+used_cache) [0x00000]
+  at Mono.CSharp.TypeManager.RealMemberLookup (System.Type invocation_type,
+System.Type qualifier_type, System.Type queried_type, MemberTypes mt,
+BindingFlags original_bf, System.String name, IList almost_match) [0x00000]
+  at Mono.CSharp.TypeManager.MemberLookup (System.Type invocation_type,
+System.Type qualifier_type, System.Type queried_type, MemberTypes mt,
+BindingFlags original_bf, System.String name, IList almost_match) [0x00000]
+  at Mono.CSharp.Expression.MemberLookup (System.Type container_type,
+System.Type qualifier_type, System.Type queried_type, System.String name,
+MemberTypes mt, BindingFlags bf, Location loc) [0x00000]
+  at Mono.CSharp.MemberAccess.ResolveNamespaceOrType (IResolveContext rc,
+Boolean silent) [0x00000]
+  at Mono.CSharp.MemberAccess.ResolveAsTypeStep (IResolveContext ec,
+Boolean silent) [0x00000]
+  at Mono.CSharp.Expression.ResolveAsBaseTerminal (IResolveContext ec,
+Boolean silent) [0x00000]
+  at Mono.CSharp.Expression.ResolveAsTypeTerminal (IResolveContext ec,
+Boolean silent) [0x00000]
+  at Mono.CSharp.TypeArguments.Resolve (IResolveContext ec) [0x00000]
+  at Mono.CSharp.ConstructedType.DoResolveType (IResolveContext ec) [0x00000]
+  at Mono.CSharp.ConstructedType.ResolveConstructedType (IResolveContext
+ec) [0x00000]
+  at Mono.CSharp.ConstructedType.DoResolveAsTypeStep (IResolveContext ec)
+[0x00000]
+  at Mono.CSharp.TypeExpr.ResolveAsTypeStep (IResolveContext ec, Boolean
+silent) [0x00000]
+  at Mono.CSharp.SimpleName.ResolveAsTypeStep (IResolveContext ec, Boolean
+silent) [0x00000]
+  at Mono.CSharp.Expression.ResolveAsBaseTerminal (IResolveContext ec,
+Boolean silent) [0x00000]
+  at Mono.CSharp.TypeContainer.GetNormalBases (Mono.CSharp.TypeExpr&
+base_class) [0x00000]
+  at Mono.CSharp.TypeContainer.GetClassBases (Mono.CSharp.TypeExpr&
+base_class) [0x00000]
+  at Mono.CSharp.Class.GetClassBases (Mono.CSharp.TypeExpr& base_class)
+[0x00000]
+  at Mono.CSharp.TypeContainer.GetNormalPartialBases (Mono.CSharp.TypeExpr&
+base_class) [0x00000]
+  at Mono.CSharp.TypeContainer.DefineTypeBuilder () [0x00000]
+  at Mono.CSharp.TypeContainer.DefineType () [0x00000]
+  at Mono.CSharp.Class.DefineType () [0x00000]
+  at Mono.CSharp.RootContext.ResolveTree () [0x00000]
+  at Mono.CSharp.Driver.MainDriver (System.String[] args) [0x00000]
+  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000]
+
+
+Expected Results:
+Should compile to a dll and throw no exception.
+
+How often does this happen? 
+Always.
+
+Additional Information:
+This bug seems to be related to:
+http://bugzilla.ximian.com/show_bug.cgi?id=77963
+(but the example given there does compile with my version of gmcs)
+
+>gmcs --version
+Mono C# compiler version 1.2.2.1


More information about the mono-bugs mailing list