Bug 59661 - Lambda expression compile fails with NullReferenceException
Summary: Lambda expression compile fails with NullReferenceException
Status: CONFIRMED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Core (show other bugs)
Version: master
Hardware: PC All
: --- normal
Target Milestone: Future Release
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-09-21 17:40 UTC by Alexander Köplinger [MSFT]
Modified: 2017-09-22 21:37 UTC (History)
2 users (show)

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


Attachments
repro code (1021 bytes, text/plain)
2017-09-21 17:40 UTC, Alexander Köplinger [MSFT]
Details

Description Alexander Köplinger [MSFT] 2017-09-21 17:40:20 UTC
Created attachment 24857 [details]
repro code

Compile attached repro code with "csc Program.cs" and run:


> Unhandled Exception:
> System.NullReferenceException: Object reference not set to an instance of an object
>   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitMethodCall (System.Linq.Expressions.Expression obj, System.Reflection.MethodInfo method, System.Linq.Expressions.IArgumentProvider methodCallExpr, System.Linq.Expressions.Compiler.LambdaCompiler+CompilationFlags flags) [0x00002] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs:367
>   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitInvocationExpression (System.Linq.Expressions.Expression expr, System.Linq.Expressions.Compiler.LambdaCompiler+CompilationFlags flags) [0x00020] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs:185
>   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression (System.Linq.Expressions.Expression node, System.Linq.Expressions.Compiler.LambdaCompiler+CompilationFlags flags) [0x00263] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Generated.cs:107
>   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody (System.Linq.Expressions.Compiler.CompilerScope parent, System.Boolean inlined, System.Linq.Expressions.Compiler.LambdaCompiler+CompilationFlags flags) [0x00079] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Lambda.cs:233
>   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody () [0x0001a] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Lambda.cs:196
>   at System.Linq.Expressions.Compiler.LambdaCompiler.Compile (System.Linq.Expressions.LambdaExpression lambda) [0x0000d] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.cs:182
>   at System.Linq.Expressions.Expression`1[TDelegate].Compile (System.Boolean preferInterpretation) [0x00000] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs:209
>   at System.Linq.Expressions.Expression`1[TDelegate].Compile () [0x00000] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs:192
>   at Program+TestClass.Test () [0x00075] in /Users/alexander/dev/test/Program.cs:21
>   at Program.Main () [0x00001] in /Users/alexander/dev/test/Program.cs:9

I noticed this in a test from ms-test-suite. It seems to be an issue in CoreFx, they actually have the same test there but it's disabled currently: https://github.com/dotnet/corefx/blob/dd48b05151c56fcf92cacc071f80fd39c099cadc/src/System.Linq.Expressions/tests/Lambda/LambdaTests.cs#L58-L71

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