[Mono-bugs] [Bug 77963][Cri] Changed - [GMCS] NRE on class X : Y<X.Z> - derived class of a generic type whose generic argument is its nested child class

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Sep 2 21:01:11 EDT 2006


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 jan.oravec at 6com.sk.

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

--- shadow/77963	2006-09-01 23:22:14.000000000 -0400
+++ shadow/77963.tmp.3137	2006-09-02 21:01:11.000000000 -0400
@@ -159,6 +159,42 @@
 
 
 ------- Additional Comments From jan.oravec at 6com.sk  2006-09-01 23:22 -------
 Created an attachment (id=17585)
 Fix for the case of nested type inside generic type
 
+
+------- Additional Comments From jan.oravec at 6com.sk  2006-09-02 21:01 -------
+My patch still doesn't work when constraints are added to the Bar<Q>,
+e.g.:
+
+public class Foo<K>
+{
+}
+
+public class Bar<Q> : Foo<Bar<Q>.Baz>
+  where Q : System.IEquatable<Q>
+{
+        public class Baz
+        {
+        }
+}
+
+Unhandled Exception: System.NullReferenceException: Object reference
+not set to an instance of an object
+  at Mono.CSharp.Constraints.ResolveTypes (IResolveContext ec) [0x00000]
+  at Mono.CSharp.TypeParameter.ResolveType (IResolveContext ec) [0x00000]
+  at Mono.CSharp.TypeParameter.DefineType (IResolveContext ec,
+System.Reflection.Emit.MethodBuilder builder,
+System.Reflection.MethodInfo implementing, Boolean is_override) [0x00000]
+  at Mono.CSharp.TypeParameter.DefineType (IResolveContext ec) [0x00000]
+  at Mono.CSharp.TypeContainer.ResolveType () [0x00000]
+  at Mono.CSharp.RootContext.PopulateTypes () [0x00000]
+  at Mono.CSharp.Driver.MainDriver (System.String[] args) [0x00000]
+  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000]
+
+
+Seems like ResolveTypes() was called before Resolve(). A quick hack
+"if(!resolved) Resolve();" in the begin of ResolveTypes() appears to
+work. When this is fixed the correct way, I would propose adding
+assertions to such places.
+


More information about the mono-bugs mailing list