Bug 14712 - Compiler Crashes with code: 1 on a simple code error.
Summary: Compiler Crashes with code: 1 on a simple code error.
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2013-09-13 08:20 UTC by Alan Price
Modified: 2013-09-13 11:40 UTC (History)
3 users (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 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.

Related Links:

Description Alan Price 2013-09-13 08:20:25 UTC
The compiler is not catching this code error and is throwing a generic and unhelpful "Compiler Crashes with code: 1"

The following is the method that was causing the issue and should have been caught by the compiler. The specific line with the issue is marked out with lines above and below.  

void ConfirmationDialog ()
    AlertDialog.Builder builder = new AlertDialog.Builder (this);
    AlertDialog confirmUpdate = builder.Create ();
    confirmUpdate.SetTitle ("Confirm Update");
    confirmUpdate.SetMessage ("Are you sure you want to Update Changes?");
    confirmUpdate.SetButton2("Cancel", (s, e) => {;});
    confirmUpdate.SetButton("OK", (s, e) => {SendUpdate;});  //Line that caused the crash. 
    confirmUpdate.Show ();

The line in question should have been :

  confirmUpdate.SetButton("OK", (s, e) => {SendUpdate(s,e);});

I was easily able to reproduce this error.
Comment 1 Jonathan Pryor 2013-09-13 11:40:20 UTC
Slight variation:

  using System;
  class Test {
    public static void Main ()
      Set ((s, e) => {Update;});

    static void Set (EventHandler handler)

    static void Update (object sender, EventArgs e)

The above doesn't cause a compiler crash, but the error output isn't helpful either:

> Compilation failed: 2 error(s), 0 warnings

Tested with mcs 3.2.0.

This does appear to be fixed in 3.2.3 (mono master/55065d0):

> bxc14712.cs(5,23): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement