【发布时间】:2013-07-02 13:24:13
【问题描述】:
哇,我从没想过我会导致在 Google 上产生零点击的错误。
这是导致它的代码:
var otherSessions =
db.ChildThing.Where(x => x.ID == thingOneID)
.SelectMany(x => x.ParentThing.ChildThings.SelectMany(x2 => x.GrandchildThings))
.Where(x=> x.Field1 == null)
.ToList();
这是一个例外:
System.Data.EntityCommandCompilationException:准备命令定义时出错。有关详细信息,请参阅内部异常。 ---> System.InvalidOperationException:内部 .NET Framework 数据提供程序错误 1004、0、泄漏谓词。 在 System.Data.Query.PlanCompiler.PlanCompiler.Assert(布尔条件,字符串消息) 在 System.Data.Query.PlanCompiler.JoinGraph.RebuildNodeTreeForCrossJoins(AugmentedJoinNode joinNode) 在 System.Data.Query.PlanCompiler.JoinGraph.RebuildNodeTree(AugmentedJoinNode joinNode,Dictionary
2& predicates) at System.Data.Query.PlanCompiler.JoinGraph.RebuildNodeTree(AugmentedNode augmentedNode, Dictionary2& 谓词) 在 System.Data.Query.PlanCompiler.JoinGraph.RebuildNodeTree(AugmentedJoinNode joinNode,Dictionary2& predicates) at System.Data.Query.PlanCompiler.JoinGraph.BuildNodeTree() at System.Data.Query.PlanCompiler.JoinGraph.DoJoinElimination(VarMap& varMap, Dictionary2& 处理节点) 在 System.Data.Query.PlanCompiler.JoinElimination.ProcessJoinGraph(节点 joinNode) 在 System.Data.Query.PlanCompiler.JoinElimination.VisitJoinOp(JoinBaseOp 操作,节点 joinNode) 在 System.Data.Query.InternalTrees.BasicOpVisitorOfT1.Visit(InnerJoinOp op, Node n) at System.Data.Query.InternalTrees.InnerJoinOp.Accept[TResultType](BasicOpVisitorOfT1 v,节点 n) 在 System.Data.Query.InternalTrees.BasicOpVisitorOfT1.VisitNode(Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitChildren(Node n) at System.Data.Query.PlanCompiler.JoinElimination.VisitDefaultForAllNodes(Node n) at System.Data.Query.PlanCompiler.JoinElimination.VisitDefault(Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitRelOpDefault(RelOp op, Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfT1.Visit(FilterOp op, 节点 n) 在 System.Data.Query.InternalTrees.FilterOp.Accept[TResultType](BasicOpVisitorOfT1 v, Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfT1.VisitNode(节点 n) 在 System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitChildren(节点 n) 在 System.Data.Query.PlanCompiler.JoinElimination.VisitDefaultForAllNodes(节点 n) 在 System.Data.Query.PlanCompiler.JoinElimination.VisitDefault(节点 n) 在 System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitRelOpDefault(RelOp 操作,节点 n) 在 System.Data.Query.InternalTrees.BasicOpVisitorOfT1.Visit(ProjectOp op, Node n) at System.Data.Query.InternalTrees.ProjectOp.Accept[TResultType](BasicOpVisitorOfT1 v,节点 n) 在 System.Data.Query.InternalTrees.BasicOpVisitorOfT1.VisitNode(Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitChildren(Node n) at System.Data.Query.PlanCompiler.JoinElimination.VisitDefaultForAllNodes(Node n) at System.Data.Query.PlanCompiler.JoinElimination.VisitDefault(Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitPhysicalOpDefault(PhysicalOp op, Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfT1.Visit(PhysicalProjectOp 操作,节点 n) 在 System.Data.Query.InternalTrees.PhysicalProjectOp.Accept[TResultType](BasicOpVisitorOfT1 v, Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfT1.VisitNode(节点 n) 在 System.Data.Query.PlanCompiler.JoinElimination.Process() 在 System.Data.Query.PlanCompiler.PlanCompiler.Compile(List1& providerCommands, ColumnMap& resultColumnMap, Int32& columnCount, Set1& entitySets) 在 System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory,DbCommandTree commandTree) --- 内部异常堆栈跟踪结束 --- 在 System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory,DbCommandTree commandTree) 在 System.Data.EntityClient.EntityProviderServices.CreateCommandDefinition(DbProviderFactory storeProviderFactory,DbCommandTree commandTree) 在 System.Data.EntityClient.EntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest,DbCommandTree commandTree) 在 System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree 命令树) 在 System.Data.Objects.Internal.ObjectQueryExecutionPlan.Prepare(ObjectContext 上下文,DbQueryCommandTree 树,类型 elementType,MergeOption 合并选项,跨度跨度,ReadOnlyCollection1 compiledQueryParameters, AliasGenerator aliasGenerator) at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable1 forMergeOption) 在 System.Data.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) 在 System.Data.Objects.ObjectQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 源) 在 c:\src\MyProject\MyBL\UIEntities\UserSession.cs:line 130 中的 MyProject.UIEntities.UserSession.SaveReadingSession(UserSession uiEntity, MyEntities db)
那么,有什么想法是我打破的吗?
【问题讨论】:
-
我更喜欢“Leaking Predicates”的错误信息——找到它做得很好!
标签: c# entity-framework-5