Bugzilla – Bug 317156
`this' is incorrect when capturing variables
Last modified: 2007-09-15 21:24:23 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".