[Mono-bugs] [Bug 76363][Nor] New - generic interface which has a recursive parameter crashes

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Oct 7 13:08:45 EDT 2005


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 atsushi at ximian.com.

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

--- shadow/76363	2005-10-07 13:08:44.000000000 -0400
+++ shadow/76363.tmp.23099	2005-10-07 13:08:44.000000000 -0400
@@ -0,0 +1,77 @@
+Bug#: 76363
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: generic interface which has a recursive parameter crashes
+
+Compile the two lines below:
+
+public interface IFoo<T> where T : IFoo<T> { }
+public interface IBaz<T> where T : IFoo<T> { }
+
+
+Actual Results:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00069> Mono.CSharp.Convert:TypeParam_EffectiveBaseType
+(Mono.CSharp.EmitContext ec, Mono.CSharp.GenericConstraints gc)
+in <0x000af> Mono.CSharp.Convert:ImplicitTypeParameterConversion
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression expr, System.Type
+target_type)
+in <0x00061> Mono.CSharp.Convert:ImplicitReferenceConversionExists
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression expr, System.Type
+target_type)
+in <0x003cd> Mono.CSharp.Convert:ImplicitStandardConversionExists
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression expr, System.Type
+target_type)
+in <0x0016f> Mono.CSharp.ConstructedType:CheckConstraint
+(Mono.CSharp.EmitContext ec, System.Type ptype, Mono.CSharp.Expression
+expr, System.Type ctype)
+in <0x00430> Mono.CSharp.ConstructedType:CheckConstraints
+(Mono.CSharp.EmitContext ec, Int32 index)
+in <0x00018> Mono.CSharp.ConstructedType:CheckConstraints
+(Mono.CSharp.EmitContext ec)
+in <0x00125> Mono.CSharp.Expression:ResolveAsTypeTerminal
+(Mono.CSharp.EmitContext ec, Boolean silent)
+in <0x00010> Mono.CSharp.Expression:ResolveAsTypeTerminal
+(Mono.CSharp.EmitContext ec)
+in <0x006c7> Mono.CSharp.Constraints:ResolveTypes (Mono.CSharp.EmitContextec)
+in <0x0001d> Mono.CSharp.TypeParameter:ResolveType (Mono.CSharp.EmitContextec)
+in <0x00031> Mono.CSharp.TypeParameter:DefineType (Mono.CSharp.EmitContext
+ec, System.Reflection.Emit.MethodBuilder builder,
+System.Reflection.MethodInfo implementing, Boolean is_override)
+in <0x00013> Mono.CSharp.TypeParameter:DefineType (Mono.CSharp.EmitContextec)
+in <0x00316> Mono.CSharp.TypeContainer:ResolveType ()
+in <0x000dd> Mono.CSharp.RootContext:PopulateTypes ()
+in <0x00b7b> Mono.CSharp.Driver:MainDriver (System.String[] args)
+in <0x00051> Mono.CSharp.Driver:Main (System.String[] args)
+
+Expected Results:
+
+no error except for "entrypoint not found".
+
+How often does this happen? 
+
+consistently.
+
+Additional Information:
+
+- When we remove the second line, it does not happen.
+- When we remove either of "where" clause, it does not happen.
+- Such interfaces could make sense e.g. with
+    class Foo : IFoo<Foo> {}
+    class Bar : IFoo<Foo> {}
+- csc compiles it without error (except for entrypoint stuff).


More information about the mono-bugs mailing list