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 [EMAIL PROTECTED]

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

--- shadow/79840        2006-11-05 19:57:23.000000000 -0500
+++ shadow/79840.tmp.32679      2006-11-05 19:57:23.000000000 -0500
@@ -0,0 +1,67 @@
+Bug#: 79840
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: C#
+AssignedTo: [EMAIL PROTECTED]                            
+ReportedBy: [EMAIL PROTECTED]               
+QAContact: [EMAIL PROTECTED]
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Anonymous methods not capturing local variables
+
+Description of Problem:
+On Mono 1.2 RC, anonymous methods are not capturing local variables
+correct. Test case:
+
+using System;
+public class Test
+{
+    public delegate void TestDelegate();
+    public static void Main(string[] args)
+    {
+        TestDelegate d = null;
+        for (int i = 1; i <= 5; i++)
+        {
+            int k = i;
+            TestDelegate temp = delegate
+            {
+                Console.WriteLine(k);
+            };
+            d += temp;
+        }
+        d();
+    }
+}
+
+Steps to reproduce the problem:
+1. 
+2. 
+3. 
+
+Actual Results:
+Test case output:
+5
+5
+5
+5
+5
+
+Expected Results:
+Test case output:
+1
+2
+3
+4
+5
+
+How often does this happen? 
+
+
+Additional Information:
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to