[Mono-bugs] [Bug 72475][Wis] New - `this' is incorrect when capturing variables

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 11 Feb 2005 00:16:29 -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 bmaurer@users.sf.net.

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

--- shadow/72475	2005-02-11 00:16:29.000000000 -0500
+++ shadow/72475.tmp.26598	2005-02-11 00:16:29.000000000 -0500
@@ -0,0 +1,53 @@
+Bug#: 72475
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: miguel@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: `this' is incorrect when capturing variables
+
+using System;
+
+delegate void Y ();
+
+class X {
+	public event Y y;
+	static void Main (string [] args)
+	{
+		X x = new X ();
+		x.Foo ();
+	}
+	
+	void Foo ()
+	{
+		int x = 1;
+		y += delegate {
+			Console.WriteLine (x);
+			Console.WriteLine (this.GetType ());
+		};
+		y ();
+		
+	}
+}
+
+This gives:
+
+[benm@omega benm]$ mono x.exe
+1
+X+<>AnonHelp<0>
+
+But should give
+1
+X
+
+Note that if the local variable is not captured, this issue doesnt happen