[Mono-bugs] [Bug 80358][Wis] New - [GMCS] Compiler crashes with certain type of generic partial class

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Dec 25 18:49:34 EST 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 frederik.carlier at ugent.be.

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

--- shadow/80358	2006-12-25 18:49:34.000000000 -0500
+++ shadow/80358.tmp.6073	2006-12-25 18:49:34.000000000 -0500
@@ -0,0 +1,98 @@
+Bug#: 80358
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: Ubuntu 6.10 with Feister packages for Mono
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: frederik.carlier at ugent.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] Compiler crashes with certain type of generic partial class
+
+Description of Problem:
+
+The compiler crashes when it encounters a special instance of a partial
+class that takes a generic parameter.
+
+This error occurs when the second part of the partial class uses a generic
+Event Handler.
+
+Steps to reproduce the problem:
+1. Create a file gpartial.cs with the following contents:
+
+## BEGIN OF FILE
+using System;
+using System.Windows.Forms;
+
+namespace Test.Common
+{
+    partial class SectionControl<T>
+    {
+
+    }
+}
+
+namespace Test.Common
+{
+    public partial class SectionControl<T> : UserControl
+    {
+        public delegate void DrawItemEventHandler(object sender,
+DrawItemEventArgs e, T item);
+    }
+}
+## END OF FILE
+
+Note that when swapping the two declarations, the error does not occur.
+
+2. Compile using gmcs gpartial.cs
+
+
+Actual Results:
+## BEGIN OF OUTPUT
+gpartial.cs(2,7): error CS0234: The type or namespace name `Windows' does
+not exist in the namespace `System'. Are you missing an assembly reference?
+gpartial.cs(2,1): error CS0246: The type or namespace name `Windows.Forms'
+could not be found. Are you missing a using directive or an assembly reference?
+
+Unhandled Exception: System.InvalidOperationException: Operation is not
+valid due to the current state of the object
+  at System.Type.GetGenericTypeDefinition () [0x00000] 
+  at System.Reflection.Emit.TypeBuilder.GetGenericTypeDefinition () [0x00000] 
+  at Mono.CSharp.TypeManager.IsEqual (System.Type a, System.Type b) [0x00000] 
+  at Mono.CSharp.TypeManager.IsNestedChildOf (System.Type type, System.Type
+parent) [0x00000] 
+  at Mono.CSharp.SimpleName.IsNestedChild (System.Type t, System.Type
+parent) [0x00000] 
+  at Mono.CSharp.SimpleName.ResolveNested (IResolveContext ec, System.Type
+t) [0x00000] 
+  at Mono.CSharp.SimpleName.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.Delegate.DefineType () [0x00000] 
+  at Mono.CSharp.TypeContainer.DefineNestedTypes () [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] 
+## END OF OUTPUT
+
+Expected Results:
+No error to occur.
+
+How often does this happen? 
+Always.
+
+Additional Information:
+This example is based on code generated by Visual Studio that compiles file
+under .NET.


More information about the mono-bugs mailing list