Bug 60253 - [csharp] Linq query with two nested and interdependent lambda expressions fails.
Summary: [csharp] Linq query with two nested and interdependent lambda expressions fails.
Alias: None
Product: Tools
Classification: Mono
Component: csharp ()
Version: master
Hardware: PC All
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2017-10-18 12:56 UTC by Vladimir Kargov
Modified: 2017-10-27 10:51 UTC (History)
6 users (show)

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

Stack trace (6.83 KB, text/plain)
2017-10-18 12:56 UTC, Vladimir Kargov

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 60253 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 Vladimir Kargov 2017-10-18 12:56:33 UTC
Created attachment 25353 [details]
Stack trace

The following expression fails when executed via "csharp" on master:

> $ # Count primes from 2 through 100
> $ csharp -e 'Enumerable.Range (2, 100).Count (n => Enumerable.Range (2, (int)Math.Sqrt (n) - 1).All (m => n % m > 0))'

> Mono.CSharp.InternalErrorException: (1,35): <InteractiveExpressionClass>.<Host>m__0(int) ---> Mono.CSharp.InternalErrorException: (1,1): ---> System.NullReferenceException: Object reference not set to an instance of an object
>   at Mono.CSharp.HoistedVariable.GetFieldExpression (Mono.CSharp.EmitContext ec) [0x00027] in <334ce87300424432a1c5a26e80c45452>:0
> ...

The full stack trace is in the attachment.

The expression works normally when compiled using "mcs" and then executed with "mono".