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: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to