Bug 26464 - FirstOrDefault Linq query entity framework 6
Summary: FirstOrDefault Linq query entity framework 6
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data (show other bugs)
Version: 3.12.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-01-27 12:11 UTC by dex3r.dx
Modified: 2015-01-30 07:41 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description dex3r.dx 2015-01-27 12:11:44 UTC
With mono 3.12.0, apache2 with mod_mono, entity framework 6 with oracle MySQL connector, following code: http://pastebin.com/LmvES5q2

var results = ( from gp in ctx.GamePlayers
								join games in ctx.Games on gp.GameID equals games.GameID
								join names in ctx.PlayersNames on gp.PlayerNameID equals names.PlayerNameID
								join player in ctx.Players on gp.PlayerID equals player.PlayerID
								where games.EndReason != 0
								where games.IsValid
								group gp by gp.PlayerID into gpp
								select new
								{
									lastName = gpp.FirstOrDefault().PlayerID,
								} );


Gives an error (at line "lastName = gpp.FirstOrDefault().PlayerID"):


System.InvalidOperationException
Internal .NET Framework Data Provider error 1004, 0, Unresolvable Var used in Command: VarType=Column, Id=72.

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): EntityFramework.
Exception stack trace:
  at System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert (Boolean condition, System.String message) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.ResolveVar (System.Data.Entity.Core.Query.InternalTrees.Var referencedVar) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.CreateProject (System.Data.Entity.Core.Query.PlanCompiler.RelOpInfo sourceInfo, IEnumerable`1 outputVars) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitProject (System.Data.Entity.Core.Query.InternalTrees.Node n, IEnumerable`1 varList) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.Visit (System.Data.Entity.Core.Query.InternalTrees.ProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.ProjectOp.Accept[DbExpression] (System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1 v, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1[System.Data.Entity.Core.Common.CommandTrees.DbExpression].VisitNode (System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitAsRelOp (System.Data.Entity.Core.Query.InternalTrees.Node inputNode) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.EnterExpressionBindingScope (System.Data.Entity.Core.Query.InternalTrees.Node inputNode, Boolean pushScope) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.EnterExpressionBindingScope (System.Data.Entity.Core.Query.InternalTrees.Node inputNode) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitProject (System.Data.Entity.Core.Query.InternalTrees.Node n, IEnumerable`1 varList) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.Visit (System.Data.Entity.Core.Query.InternalTrees.ProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.ProjectOp.Accept[DbExpression] (System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1 v, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1[System.Data.Entity.Core.Common.CommandTrees.DbExpression].VisitNode (System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitAsRelOp (System.Data.Entity.Core.Query.InternalTrees.Node inputNode) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.EnterExpressionBindingScope (System.Data.Entity.Core.Query.InternalTrees.Node inputNode, Boolean pushScope) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.EnterExpressionBindingScope (System.Data.Entity.Core.Query.InternalTrees.Node inputNode) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitProject (System.Data.Entity.Core.Query.InternalTrees.Node n, IEnumerable`1 varList) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.Visit (System.Data.Entity.Core.Query.InternalTrees.ProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.ProjectOp.Accept[DbExpression] (System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1 v, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1[System.Data.Entity.Core.Common.CommandTrees.DbExpression].VisitNode (System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitAsRelOp (System.Data.Entity.Core.Query.InternalTrees.Node inputNode) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.EnterExpressionBindingScope (System.Data.Entity.Core.Query.InternalTrees.Node inputNode, Boolean pushScope) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.EnterExpressionBindingScope (System.Data.Entity.Core.Query.InternalTrees.Node inputNode) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitProject (System.Data.Entity.Core.Query.InternalTrees.Node n, IEnumerable`1 varList) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.Visit (System.Data.Entity.Core.Query.InternalTrees.ProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.ProjectOp.Accept[DbExpression] (System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1 v, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1[System.Data.Entity.Core.Common.CommandTrees.DbExpression].VisitNode (System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitAsRelOp (System.Data.Entity.Core.Query.InternalTrees.Node inputNode) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.EnterExpressionBindingScope (System.Data.Entity.Core.Query.InternalTrees.Node inputNode, Boolean pushScope) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.EnterExpressionBindingScope (System.Data.Entity.Core.Query.InternalTrees.Node inputNode) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitProject (System.Data.Entity.Core.Query.InternalTrees.Node n, IEnumerable`1 varList) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.BuildProjection (System.Data.Entity.Core.Query.InternalTrees.Node relOpNode, IEnumerable`1 projectionVars) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.Visit (System.Data.Entity.Core.Query.InternalTrees.PhysicalProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.PhysicalProjectOp.Accept[DbExpression] (System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1 v, System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1[System.Data.Entity.Core.Common.CommandTrees.DbExpression].VisitNode (System.Data.Entity.Core.Query.InternalTrees.Node n) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator..ctor (System.Data.Entity.Core.Query.InternalTrees.Command itree, System.Data.Entity.Core.Query.InternalTrees.Node toConvert) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.Generate (System.Data.Entity.Core.Query.InternalTrees.Command itree, System.Data.Entity.Core.Query.InternalTrees.Node toConvert) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.ProviderCommandInfoUtils.Create (System.Data.Entity.Core.Query.InternalTrees.Command command, System.Data.Entity.Core.Query.InternalTrees.Node node) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CodeGen.Process (System.Collections.Generic.List`1& childCommands, System.Data.Entity.Core.Query.InternalTrees.ColumnMap& resultColumnMap, System.Int32& columnCount) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.CodeGen.Process (System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler compilerState, System.Collections.Generic.List`1& childCommands, System.Data.Entity.Core.Query.InternalTrees.ColumnMap& resultColumnMap, System.Int32& columnCount) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Compile (System.Collections.Generic.List`1& providerCommands, System.Data.Entity.Core.Query.InternalTrees.ColumnMap& resultColumnMap, System.Int32& columnCount, System.Data.Entity.Core.Common.Utils.Set`1& entitySets) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Compile (System.Data.Entity.Core.Common.CommandTrees.DbCommandTree ctree, System.Collections.Generic.List`1& providerCommands, System.Data.Entity.Core.Query.InternalTrees.ColumnMap& resultColumnMap, System.Int32& columnCount, System.Data.Entity.Core.Common.Utils.Set`1& entitySets) [0x00000] in <filename unknown>:0 
  at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor (System.Data.Common.DbProviderFactory storeProviderFactory, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, System.Data.Entity.Core.Query.ResultAssembly.BridgeDataReaderFactory bridgeDataReaderFactory, System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory columnMapFactory) [0x00000] in <filename unknown>:0
Comment 1 dex3r.dx 2015-01-30 07:41:30 UTC
It works with MS .Net on Windows.

Note You need to log in before you can comment on or make changes to this bug.