[Mono-bugs] [Bug 480100] New: Internal error compiling LINQ query with continuation

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 26 16:20:24 EST 2009


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


           Summary: Internal error compiling LINQ query with continuation
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: ekot at narod.ru
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Opera/10.00 (X11; Linux x86_64 ; U; en) Presto/2.2.0

Compiler crashes with internal error when compiling following code. Problem
exists in 2.2 and 2.4 RC1 and not exists in .NET 3.5SP1

Reproducible: Always

Steps to Reproduce:
1. save following code as Main.cs and compile it with
gmcs -r:System.Data.Linq.dll Main.cs

using System.Data.Linq;
using System.Linq;

namespace test
{
    public partial class Product
    {
        public int CategoryID;
        public decimal UnitPrice;
    }
    class MainClass
    {
        public static void Main(string[] args)
        {
            DataContext context = new DataContext("");
            Table<Product> products = context.GetTable<Product>();
            var categories = (from p in products
                              group p by p.CategoryID into g
                              select new
                              {
                                  CategoryID = g.Key,
                                  CheapestProducts = from p2 in g
                                                     where p2.UnitPrice ==
g.Min(p3 => p3.UnitPrice)
                                                     select p2
                              });

        }
    }
}

Actual Results:  
Main.cs(17,17): warning CS0168: The variable `categories' is declared but never
used
Exception caught by the compiler while emitting:
   Block that caused the problem begin at: Main.cs(14,17):
System.NullReferenceException: Object reference not set to an instance of an
object
Internal compiler error at Main.cs(13,36):: exception caught while emitting
MethodBuilder [MainClass::Main]

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at Mono.CSharp.FieldExpr..ctor (System.Reflection.FieldInfo fi, Location l)
[0x00000] 
  at Mono.CSharp.HoistedVariable.GetFieldExpression (Mono.CSharp.EmitContext
ec) [0x00000] 
  at Mono.CSharp.HoistedVariable+ExpressionTreeProxy.Emit
(Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments, Boolean dup_args,
Mono.CSharp.LocalTemporary this_arg) [0x00000] 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, System.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean omit_args) [0x00000] 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, System.Collections.ArrayList Arguments, Location loc) [0x00000] 
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments) [0x00000] 
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ArrayCreation.EmitDynamicInitializers (Mono.CSharp.EmitContext
ec, Boolean emitConstants) [0x00000] 
  at Mono.CSharp.ArrayCreation.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments, Boolean dup_args,
Mono.CSharp.LocalTemporary this_arg) [0x00000] 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, System.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean omit_args) [0x00000] 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, System.Collections.ArrayList Arguments, Location loc) [0x00000] 
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments) [0x00000] 
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments, Boolean dup_args,
Mono.CSharp.LocalTemporary this_arg) [0x00000] 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, System.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean omit_args) [0x00000] 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, System.Collections.ArrayList Arguments, Location loc) [0x00000] 
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments) [0x00000] 
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments, Boolean dup_args,
Mono.CSharp.LocalTemporary this_arg) [0x00000] 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, System.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean omit_args) [0x00000] 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, System.Collections.ArrayList Arguments, Location loc) [0x00000] 
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments) [0x00000] 
  at Mono.CSharp.ExtensionMethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments) [0x00000] 
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.VariableReference.EmitAssign (Mono.CSharp.EmitContext ec,
Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load)
[0x00000] 
  at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement)
[0x00000] 
  at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.EmitContext.EmitResolvedTopBlock (Mono.CSharp.ToplevelBlock
block, Boolean unreachable) [0x00000] 
  at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelBlock block) [0x00000] 


Expected Results:  
Code should be compiled without errors.

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