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)

See Also:
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

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

Note You need to log in before you can comment on or make changes to this bug.