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 21992 [details]
Sample solution attached detailing the compiler crash
Using Mono JIT compiler version 4.8.0 (Stable 22.214.171.1245/e4a3cf3 Mon Feb 27 08:30:18 UTC 2017)
Sample project attached with a very isolated reproducible example. Either build the solution using xbuild or use the provided commandline to compile it:
> mcs /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/CrashTest.dll A.cs B.cs Properties/AssemblyInfo.cs ValueType.cs obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs /target:library /define:"DEBUG;TRACE" /nostdlib /platform:AnyCPU /reference:/usr/lib/mono/4.5-api/System.dll /reference:/usr/lib/mono/4.5-api/System.Data.dll /reference:/usr/lib/mono/4.5-api/System.Xml.dll /reference:/usr/lib/mono/4.5-api/System.Core.dll /reference:/usr/lib/mono/4.5-api//mscorlib.dll /warn:4
The stacktrace is long and is ommitted in this report for brevity. A full copy of the stderr of the compiler is contained in crash.log in the project tarball. Compiling an async method which returns a Task<struct> crashes the mono compiler when the results of an await is used as a parameter to the constructor of another value type inline without the use of a temporary local for storage.
The offending line is here in A.cs:18:
> return new ValueType(local1, await b.ProduceStructure(input1, input2));
b.ProduceStructure produces a Task<long>. If I set the result of the awaited b.ProduceStructure is set to a local the compiler will emit successfully, so this is able to be fairly easily worked around, alas not a huge priority.
I feel that this is loosely related to #42224 - but was marked resolved in 4.6/stable and it is reproducible for me.
Thanks for your time in looking at this!
Fixed in master and 2017-04 branch