Open
Description
This is passing on .NET Framework but failing on .NET Core.
ParameterExpression tmp = Expression.Parameter(typeof(object), "tmp");
var body = Expression.Lambda<Func<object>>(
Expression.Block(
Expression.Block(
new[] { tmp },
Expression.Assign(tmp, Expression.Constant(42, typeof(object)))
),
Expression.Block(
new[] { tmp },
tmp
)
)
);
Debug.Assert(body.Compile()() is null);
I'm not sure which runtime is correct. If .NET Framework has the correct behavior then an issue should probably be filed for .NET Core (and Mono?). Note that CompilerHelpers.LightCompile(body)() is null
so if .NET Core is correct should we "fix" the light compiler?