";泄漏谓词”;错误
本文关键字:错误 谓词 泄漏 quot | 更新日期: 2023-09-27 18:20:39
哇,我从没想过我会在谷歌上造成一个点击率为零的错误。
这是导致它的代码:
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, Dictionary
2&谓词)位于System.Data.Query.PlanCompiler.JoinGraph.RebuildNodeTree(AugmentedJoinNode,Dictionary2& predicates) at System.Data.Query.PlanCompiler.JoinGraph.BuildNodeTree() at System.Data.Query.PlanCompiler.JoinGraph.DoJoinElimination(VarMap& varMap, Dictionary
2&processedNodes)位于System.Data.Query.PlanCompiler.JoinLimination.ProcessJoinGraph(节点joinNode)位于System.Data.Query.PlanCompiler.JoinLimination.VisitJoinPO(JoinBaseOp op,Node joinNode)位于System.Data.Query.InternalTrees.BasicOpVisitorOfT1.Visit(InnerJoinOp op, Node n) at System.Data.Query.InternalTrees.InnerJoinOp.Accept[TResultType](BasicOpVisitorOfT
1 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.BasicOpVisitorOfT
1.访问(FilterOp-op,节点n)在System.Data.Query.InteralTrees.FilterOp.Accept[TResultType](BasicOpVisitorOfT1 v, Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfT
1.VisitNode(节点n)位于System.Data.Query.InteralTrees.BasicOpVisitorOfNode.VisitChildren(节点n)位于System.Data.Query.PlanCompiler.JoinLimination.VisitDefaultForAllNodes(节点n)位于System.Data.Query.PlanCompiler.JoinLimination.VisitDefault(节点n)位于System.Data.Query.InteralTrees.BasicOpVisitorOfNode.VisitRlOpDefault(RelOp-op,Node n)位于System.Data.Query.InternalTrees.BasicOpVisitorOfT1.Visit(ProjectOp op, Node n) at System.Data.Query.InternalTrees.ProjectOp.Accept[TResultType](BasicOpVisitorOfT
1 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.BasicOpVisitorOfT
1.访问(PhysicalProjectOp-op,节点n)在System.Data.Query.InteralTrees.PhysicalProjectOp.Accept[TResultType](BasicOpVisitorOfT1 v, Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfT
1.VisitNode(节点n)位于System.Data.Query.PlanCompiler.JoinLimination.Process()位于System.Data.Query.PlanCompiler.PlanCompiler.Compile(列出1& providerCommands, ColumnMap& resultColumnMap, Int32& columnCount, Set
1&entitySet)位于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命令树)位于System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree命令树)位于System.Data.Objects.Internal.ObjectQueryExecutionPlan.Prepare(ObjectContext上下文,DbQueryCommandTree树,Type elementType,MergeOption MergeOption,Span-Span,ReadOnlyCollection1 compiledQueryParameters, AliasGenerator aliasGenerator) at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable
1 for MergeOption)位于System.Data.Objects.ObjectQuery1.GetResults(Nullable
1 for MergeOption)位于System.Data.Objects.ObjectQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1源)位于c:''src''MyProject''MyBL''UIEntities''UserSession.cs:line 130 中的MyProject.UIEntitys.UserSession.SaveReadingSession(UserSession uiEntity,MyEntities db)
那么,有什么我打破的想法吗?
哈,我在发布问题时发现了答案!问题在于λ...SelectMany(x2 => x.GrandchildThings)...
当然,应该是x2.GrandchildThings
。问题解决了。