Bug 53789 - Mono Compiler Service fails to compile lambda expression with Hoisted Variable
Summary: Mono Compiler Service fails to compile lambda expression with Hoisted Variable
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.6.0 (C8)
Hardware: PC All
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2017-03-22 13:39 UTC by Erik Schilling
Modified: 2017-03-22 13:40 UTC (History)
1 user (show)

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


Attachments
Minimal Code example (358 bytes, text/plain)
2017-03-22 13:39 UTC, Erik Schilling
Details
Complete Stacktrace (3.83 KB, text/plain)
2017-03-22 13:40 UTC, Erik Schilling
Details


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 53789 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:
Status:
NEW

Description Erik Schilling 2017-03-22 13:39:49 UTC
Created attachment 20679 [details]
Minimal Code example

Minimal Example code (also attached):
var evaluator = new Evaluator(new CompilerContext(new CompilerSettings(), new ConsoleReportPrinter()));
evaluator.Run("using System.Collections.Generic; using System; using System.Linq;");

Assert.IsNotNull(evaluator.Compile(@"new Func<Dictionary<string, string>, object>((Dictionary<string, string> dict) => from x in new [] {1, 2, 3} select dict);"));


Exception (full backtrace in the attachments):
Mono.CSharp.InternalErrorException: (1,44): <InteractiveExpressionClass>.<Host>m__0(Fs.Common.Data.ISession) ---> Mono.CSharp.InternalErrorException: (1,1): ---> System.NullReferenceException


This becomes troublesome when trying to compile NHibernate Linq Statements. I cannot pass the session into the Func<> without triggering this issue. The use in the first "from" clause seems to be ok, but using a second "from" clause or selecting the variable triggers this exception.
Comment 1 Erik Schilling 2017-03-22 13:40:18 UTC
Created attachment 20680 [details]
Complete Stacktrace