[Mono-bugs] [Bug 71483][Nor] New - Error in a Delegate that belongs to a class

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 19 Jan 2005 16:29:51 -0500 (EST)


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 spigaz@gmail.com.

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

--- shadow/71483	2005-01-19 16:29:51.000000000 -0500
+++ shadow/71483.tmp.4033	2005-01-19 16:29:51.000000000 -0500
@@ -0,0 +1,80 @@
+Bug#: 71483
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: spigaz@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Error in a Delegate that belongs to a class
+
+Description of Problem:
+
+When a delegate is declared inside a generic class, if it uses the generic
+type, that flags an error...
+
+
+Steps to reproduce the problem:
+1. Place this inside a file:
+    class Test
+    {
+        static void Main(string[] args)
+        {
+            A<int> a = new A<int>(new A<int>.B(D), 3);
+            a.Run();
+        }
+        public static void D(int y)
+        {
+            System.Console.WriteLine("Hello " + 3);
+        }
+    }
+    class A<T>
+    {
+        public delegate void B(T t);
+
+        protected B _b;
+        protected T _value;
+
+        public A(B b, T value)
+        {
+          _b = b;
+          _value = value;
+      }
+        public void Run()
+        {
+            _b(_value);
+        }
+    }
+
+2. Compile it 
+3. 
+
+Actual Results:
+Unhandled Exception: System.InvalidOperationException: Operation is not
+valid due to the current state of the object
+in <0x00045> Mono.CSharp.TypeParameter:Define
+(System.Reflection.Emit.GenericTypeParameterBuilder)
+in <0x003a5> Mono.CSharp.Delegate:DefineType ()
+in <0x00395> Mono.CSharp.TypeContainer:DefineNestedTypes ()
+in <0x00acf> Mono.CSharp.TypeContainer:DefineType ()
+in <0x00367> Mono.CSharp.RootContext:ResolveTree ()
+in <0x00a8d> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0001f> Mono.CSharp.Driver:Main (string[])
+
+
+Expected Results:
+Hello 3 (When executed)
+
+How often does this happen? 
+Always
+
+Additional Information:
+Tested with .Net 2.0