[Mono-bugs] [Bug 386068] New: Compiler crash when method parameter used in LINQ expression

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri May 2 12:22:16 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=386068


           Summary: Compiler crash when method parameter used in LINQ
                    expression
           Product: Mono: Compilers
           Version: SVN
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: jan.oravec at 6com.sk
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Marek, thanks for your fantastic work on expression trees.

I see the implementation in compiler is finished so I hope it is fine to start
with bug reporting :).

It seems that when method parameters are used in expressions, like in the
following code:

using System;
using System.Linq.Expressions;

class Foo
{
  public void Goo (bool hoo)
  {
    bool _hoo = hoo;

    Expression<Predicate<Foo>> x = obj => hoo;    // doesn't work
    Expression<Predicate<Foo>> y = obj => _hoo;   // works
  }
}

The compiler crashes with:

Unhandled Exception: Mono.CSharp.InternalErrorException: foo.cs(5,7): Foo --->
System.InvalidOperationException: Method 'Foo.Goo' does not have a method body.
  at System.Reflection.Emit.MethodBuilder.fixup () [0x00000] 
  at System.Reflection.Emit.TypeBuilder.CreateType () [0x00000] 
  at Mono.CSharp.TypeContainer.CloseType () [0x00000] --- End of inner
exception stack trace ---

  at Mono.CSharp.TypeContainer.CloseType () [0x00000] 
  at Mono.CSharp.RootContext.CloseTypes () [0x00000] 
  at Mono.CSharp.Driver.Compile () [0x00000] 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000]


-- 
Configure bugmail: https://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