This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 42224 - Compiler crashed with code: 1, "Await yields with non-empty stack" from AssertEmptyStack ()
Summary: Compiler crashed with code: 1, "Await yields with non-empty stack" from Asser...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.4.0 (C7)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-06-28 23:14 UTC by Ryan Niebur
Modified: 2016-07-28 12:42 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Example solution causing the crash, including the Build Output log (19.77 KB, application/zip)
2016-06-28 23:14 UTC, Ryan Niebur
Details

Description Ryan Niebur 2016-06-28 23:14:05 UTC
Created attachment 16513 [details]
Example solution causing the crash, including the Build Output log

Using Xamarin Studio 6.0.1 (build 9), up to date from the Stable channel, we were unable to build due to this error:
		/Library/Frameworks/Mono.framework/Versions/4.4.1/lib/mono/4.5/Microsoft.CSharp.targets: error : Compiler crashed with code: 1.

The problem turned out to be caused by this code pattern:
		Data += await GetHello () + "!\n" + 123.ToString () + "...";

For this to crash the compiler, Data must be a property, 123.ToString() cannot be a string literal, and both the string literals must be there in that pattern. Code following this pattern built fine in Visual Studio.

Here is the exception from the build output (where line 16 is the beginning of the function containing that code pattern):
		Unhandled Exception:
		Mono.CSharp.InternalErrorException: Program.cs(16,9): CompilerCrash.MainClass.<Demo>c__async0.MoveNext() ---> Mono.CSharp.InternalErrorException: (1,1): ---> Mono.CSharp.InternalErrorException: Await yields with non-empty stack in `CompilerCrash.MainClass.<Demo>c__async0.MoveNext()
		  at Mono.CSharp.EmitContext.AssertEmptyStack () <0x24e0350 + 0x000cc> in <filename unknown>:0 

Program.cs and BuiltOutput.log are attached, providing a full example.

I verified this happens in both Xamarin.iOS and Console projects.
Comment 1 Marek Safar 2016-07-28 12:42:02 UTC
Fixed in master and Mono 4.6

Note You need to log in before you can comment on or make changes to this bug.