Bug 19876 - CSharp REPL throws LINQ exception when parsing nested classes
Summary: CSharp REPL throws LINQ exception when parsing nested classes
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2014-05-18 18:06 UTC by Stone
Modified: 2014-05-26 08:53 UTC (History)
1 user (show)

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

Screenshot (74.62 KB, image/png)
2014-05-18 18:06 UTC, Stone

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 Stone 2014-05-18 18:06:52 UTC
Created attachment 6831 [details]

Ok, I know this summary looks a bit crazy but to reproduce this is quite easy.

Just open the csharp repl and type 
> class A { class B {} }

And you'll get this unrelated Linq exception:
(1,20): error CS0589: Internal compiler error during parsingSystem.ArgumentNullException: Argument cannot be null.
Parameter name: source
  at System.Linq.Check.SourceAndPredicate (System.Object source, System.Object predicate) [0x00017] in /build/buildd/mono-3-3.2.4/mcs/class/System.Core/System.Linq/Check.cs:81 
And for some reason calling this code:
namespace System.Linq {

	static class Check {
                public static void SourceAndPredicate (object source, object predicate)
			if (source == null)
				throw new ArgumentNullException ("source");
			if (predicate == null)
				throw new ArgumentNullException ("predicate");

I would say that this an important bug to fix as projects like scriptcs are relying on this for Mac and *nix, and for other (hopefully) obvious reasons.
Comment 1 Stone 2014-05-26 08:53:52 UTC
This has been fixed in this merged PR