Bug 38703

Summary: Linq.Expression when assigned from a lambda exression aren't constructed correctly
Product: [Mono] Compilers Reporter: James Cook <jcook>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: jcook, masafa, mono-bugs+mono
Priority: ---    
Version: 4.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:

Description James Cook 2016-02-12 02:29:31 UTC
This unit test should pass:
using System;
using System.Linq.Expressions;
using NUnit.Framework;

namespace TestNamespace
{
    [TestFixture]
    public class ExpressionTests
    {
        class HasAction
        {
            public void Start()
            {
            }
        }

        [Test]
        public void TestExpressionHasCorrectObject()
        {
            var expectedObject = typeof (HasAction).GetMethod("Start");

            Expression<Func<HasAction, Action>> methodToUse = r => r.Start;
            UnaryExpression unary = methodToUse.Body as UnaryExpression;
            MethodCallExpression methodCall = unary.Operand as MethodCallExpression;
            ConstantExpression constantExpression = methodCall.Object as ConstantExpression;

            Assert.AreSame(expectedObject, constantExpression.Value);
        }
    }
}

It currently fails under mono.
Comment 1 Marek Safar 2016-02-15 16:03:06 UTC
Fixed in master