Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 2407 [details]
Compiler bug handling anonymous methods
Compiling our application with mcs from 2.11.3 succeeds, but results in some invalid generated code which subsequently crashes the application when run. I have attached a program that isolates the method that is causing the crash in our application. Reflecting over the compiled sample program with Reflector, the generated code appears to be incorrect. Logging out in the program produces the following:
B.Parse (before AddRange): m_c is a CompilerBug.C
C.Split: c is a CompilerBug.C
B.Parse (in Where): m_c is a System.Collections.Generic.List`1[CompilerBug.E]
The third line show that the variable captured in the anonymous method is not correct. To reproduce, compile the attached program with mcs from mono 2.11.3 (I believe this is still an issue in master) and run. The program will throw an exception when run (which should not occur).
Fixed in master