[Mono-bugs] [Bug 78786][Nor] Changed - Compiler crash on anonymous methods stored in Dictionary.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jul 7 06:18:22 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 ohh at scisoft.dk.

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

--- shadow/78786	2006-07-07 06:13:34.000000000 -0400
+++ shadow/78786.tmp.7306	2006-07-07 06:18:22.000000000 -0400
@@ -2,13 +2,13 @@
 Product: Mono: Compilers
 Version: 1.1
 OS: GNU/Linux [Other]
 OS Details: Fedora Core 2
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: C#
 AssignedTo: rharinath at novell.com                            
 ReportedBy: ohh at scisoft.dk               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -68,6 +68,30 @@
 Additional Information:
 The code works as intended on .NET 2.0 (Windows). The problem is found in
 1.1.15 but still remains in 1.1.16.
 
 Interessetingly the compiler does now die, if the delegate is stored into a
 local variable (and not into a dictionary as in the sample above).
+
+------- Additional Comments From ohh at scisoft.dk  2006-07-07 06:18 -------
+The following code works as intended:
+using System.Collections.Generic;
+
+public class Test {
+        public delegate int TestDel (int a);
+
+        public static void Main (string[] args) {
+                Dictionary<string, TestDel> dict = new
+Dictionary<string, TestDel> ();
+
+                TestDel testDel = delegate (int b) {
+                        return b;
+                };
+
+                dict["a"] = testDel;
+
+                System.Console.WriteLine (dict["a"] (2));
+        }
+}
+
+So temporarily storing the delegate into a local variable is a work
+around.


More information about the mono-bugs mailing list