Bug 317156 (MONO72475) - `this' is incorrect when capturing variables
Summary: `this' is incorrect when capturing variables
Status: RESOLVED FIXED
Alias: MONO72475
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Miguel de Icaza
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-11 07:16 UTC by Ben Maurer
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:06:59 UTC


---- Reported by bmaurer@users.sf.net 2005-02-11 00:16:29 MST ----

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



---- Additional Comments From miguel@ximian.com 2005-02-11 02:12:00 MST ----

Fixed on SVN.


Unknown operating system unknown. Setting to default OS "Other".