Bug 13922 - Passing lamda to constructor not reporting compiler errors
Summary: Passing lamda to constructor not reporting compiler errors
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-08-12 11:01 UTC by Brian Chance
Modified: 2013-08-14 04:47 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Brian Chance 2013-08-12 11:01:17 UTC
When passing a lamda to a constructor with {}, the compiler crashes and indicates "Check the build output pad for details", but there is no detail.

Xamarin Studio: 4.0.12 (build 3)
Mono: 3.2.0
Xamarin.iOS: 6.4.1.1 (business edition)

Example: 

The first constructor has an error CS0201, crashes the compiler and does not show.

using System;
using MonoTouch.Dialog;

namespace Test
{
	public class SlideTableViewController : DialogViewController
	{
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			var x = 0;

			//this crashes the compiler, note the == AND {}
			//Error: The compiler appears to have crashed. Check the build output pad for details.
			// nothing in the output pad

			//error should be
			//Error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement (CS0201) (Touch)
			var one = new StyledStringElement("Test", () => {x == 1;});

			//shows compiler error as expected
			var two = new StyledStringElement("Test", () => x == 1);

			//shows compiler error as expected
			var three = new StyledStringElement("Test");
			three.Tapped += () => { x == 1;};

		}
	}
}
Comment 1 Marek Safar 2013-08-14 04:47:00 UTC
Fixed in master and 3-2 branch