[Mono-bugs] [Bug 536710] New: InvalidProgramException from using 'let' in query expression

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Sep 3 17:48:38 EDT 2009


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


           Summary: InvalidProgramException from using 'let' in query
                    expression
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86-64
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: jbevain at novell.com
        ReportedBy: jpryor at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Consider the following program:

  using System;
  using System.Linq;

  class Test {
    public static void Main ()
    {
      var source = new[]{
        new { UnitPrice = (decimal?) null },
        new { UnitPrice = (decimal?) 42 },
      };
      var categories = from p in source.AsQueryable()
        let Key = new { Criterion = p.UnitPrice > 10 || p.UnitPrice == null }
        select Key;
      foreach (var c in categories)
        Console.WriteLine (c.Criterion);
    }
  }

Compile & Run.

Expected output (from .NET):
  True
  True

Actual output: 

Unhandled Exception: System.InvalidProgramException: Invalid IL code in
(wrapper dynamic-method)
System.Runtime.CompilerServices.ExecutionScope:lambda_method
(System.Runtime.CompilerServices.ExecutionScope,<>__AnonType0`1<System.Nullable`1<System.Decimal>>):
IL_0054: ldc.i4.0  


at (wrapper managed-to-native) System.Delegate.CreateDelegate_internal
(System.Type,object,System.Reflection.MethodInfo,bool) <0x00057>
at System.Delegate.CreateDelegate
(System.Type,object,System.Reflection.MethodInfo,bool) <0x00607>
at System.Delegate.CreateDelegate
(System.Type,object,System.Reflection.MethodInfo) <0x00027>
at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type,object)
<0x0003b>
at System.Linq.Expressions.EmitContext.CreateDelegate
(System.Runtime.CompilerServices.ExecutionScope) <0x00033>
at System.Linq.Expressions.CompilationContext.CreateDelegate
(int,System.Runtime.CompilerServices.ExecutionScope) <0x0003b>
at System.Runtime.CompilerServices.ExecutionScope.CreateDelegate (int,object[])
<0x0006f>
at (wrapper dynamic-method)
System.Runtime.CompilerServices.ExecutionScope.lambda_method
(System.Runtime.CompilerServices.ExecutionScope) <0x00073>
at
System.Linq.QueryableEnumerable`1<<>__AnonType1`1<bool>>.Execute<System.Collections.Generic.IEnumerable`1<<>__AnonType1`1<bool>>>
(System.Linq.Expressions.Expression) <0x0007c>
at System.Linq.QueryableEnumerable`1<<>__AnonType1`1<bool>>.GetEnumerator ()
<0x0003f>
at Test.Main () <0x0086f>

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


More information about the mono-bugs mailing list