Bug 41400 - Internal compiler error due to invalid throw expression
Summary: Internal compiler error due to invalid throw expression
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 4.4.0 (C7)
Hardware: PC Mac OS
: --- minor
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2016-05-31 16:25 UTC by Matt Ward
Modified: 2016-05-31 16:25 UTC (History)
1 user (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 for Bug 41400 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Matt Ward 2016-05-31 16:25:33 UTC
With the following invalid code:

viewModel.LoadPackagesAsyncTask = (token) => {
	return Task.Run	(() => throw new Exception ("Error"));

When building this with xbuild the compiler returns an internal compiler error:

MyClass.cs(18,27): error CS1525: Unexpected symbol `throw'
MyClass.cs(18,56): error CS1525: Unexpected symbol `)'
MyClass.cs(19,5): error CS0589: Internal compiler error during parsingSystem.NullReferenceException: Object reference not set to an instance of an object

Full source code is available from:


Mono version: mono-4.4.0-branch/67b89ea Fri May 20 23:36:11 EDT 2016)

On Windows using MSBuild I get:

MyClass.cs(18,28,18,33): error CS1525: Invalid expression term 'throw'
MyClass.cs(18,28,18,33): error CS1026: ) expected
MyClass.cs(18,28,18,33): error CS1002: ; expected
MyClass.cs(18,57,18,58): error CS1002: ; expected
MyClass.cs(18,57,18,58): error CS1513: } expected