Bug 9949 - Compiler crash on a syntax error
Summary: Compiler crash on a syntax error
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2013-01-31 13:14 UTC by Jérémie Laval
Modified: 2013-02-01 04:07 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 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 Jérémie Laval 2013-01-31 13:14:01 UTC
namespace Foo
	public class FooTest : FooBaseTest<FooType>
		public override string[] TargetedProperties {
			get {
				return new string[] { "foo" };

		public void TestFoo ()
			var expectedElement = new XElement ("foo", new XAttribute ("key", "plop"),
			                                    new XAttribute ("lala", "loulou"),
			                                    new XAttribute ("yarr", 15));

			DefaultTestOnElement<string> ("FooBar", expectedElement,
			                              () => "System"
			                              () => "System 2");

With the above snippet with a syntax error on the DefaultTestOnElement method call (missing a comma after the first lambda parameter) the compiler crash at compilation.

Prototype of DefaultTestOnElement:
protected void DefaultTestOnElement<TElement> (string vClass,
                                               XElement expectedElement,
                                               Func<TElement> testValueFactory, 
                                               Func<TElement> defaultValueFactory = null)

Mono version info:

Mono JIT compiler version 3.0.4 (master/c439e14 Mon Jan 28 06:18:25 EST 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.1svn-mono)
	GC:            Included Boehm (with typed GC)

Compiler exception:

: error CS1525: Unexpected symbol `('
: error CS1525: Unexpected symbol `=>'
: error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
: error CS1525: Unexpected symbol `)'
: error CS0589: Internal compiler error during parsingSystem.InvalidCastException: Cannot cast from source type to destination type.
  at Mono.CSharp.CSharpParser.case_144 () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.CSharpParser.yyparse (yyInput yyLex) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.CSharpParser.parse () [0x00000] in <filename unknown>:0
Comment 1 Marek Safar 2013-02-01 04:07:12 UTC
Fixed in master