[Mono-bugs] [Bug 517028] New: Strange LINQ Expression behaviour

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jun 26 16:26:46 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=517028


           Summary: Strange LINQ Expression behaviour
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: fog at initd.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The simple code that follows shows two different problems detailed below.

using System;
using System.Linq.Expressions;

class Test
{
    public static void Main()
    {
        int? i = 0;
        Expression<Func<String>> e3 = Expression.Lambda<Func<String>>(
            Expression.Convert(Expression.Constant(i), typeof(String),
                               typeof(Convert).GetMethod("ToString", new
Type[1] { typeof(int?) })));
        Console.WriteLine("SHOULD NOT WHIS BE NULL? " +
typeof(Convert).GetMethod("ToString", new Type[1] { typeof(int?) }));
        Console.WriteLine(e3.Compile()());
    }
}

Problems:

While Convert does not have a ToString(Int32?) method, GetMethod returns a
method with ToString(Object) as signature instead of null.

The program fails during Compile() with a "System.InvalidProgramException:
Invalid IL code" exception.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list