2013-07-02 2 views
3

Вау, я никогда не думал, что я вызову ошибку, которая даст нулевые удары в 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, словарь предиката) в System.Data.Query.PlanCompiler.JoinGraph.RebuildNodeTree (AugmentedJoinNode joinNode, словарь processedNodes) на System.Data.Query.PlanCompiler.JoinElimination.ProcessJoinGraph (Узел joinNode) в System.Data.Query.PlanCompiler.JoinElimination.VisitJoinOp (JoinBaseOp op, Node joinNode) в System.Data.Query.InternalTrees.BasicOpVisito rOfT 1.Visit(InnerJoinOp op, Node n) at System.Data.Query.InternalTrees.InnerJoinOp.Accept[TResultType](BasicOpVisitorOfT 1 об, узел п) на System.Data.Query.InternalTrees.BasicOpVisitorOfT 1.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.Visit (FilterOp оп, узел п) на System.Data.Query.InternalTrees.FilterOp.Accept [TResultType] (BasicOpVisitorOfT 1 v, Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfT 1 .VisitNode (Узел п) на System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitChildren (Узел п) на System.Data.Query.PlanCompiler.JoinElimination.VisitDefaultForAllNodes (Узел п) на System.Data.Query.PlanCompiler. JoinElimination.VisitDefault (Узел п) на System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitRelOpDefault (RelOp оп, узел п) на System.Data.Query.InternalTrees.BasicOpVisitorOfT 1.Visit(ProjectOp op, Node n) at System.Data.Query.InternalTrees.ProjectOp.Accept[TResultType](BasicOpVisitorOfT 1 в, узел п) в System.Data .Query.InternalTre es.BasicOpVisitorOfT 1.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.Visit (PhysicalProjectOp оп, узел п) на System.Data.Query.InternalTrees.PhysicalProjectOp.Accept [TResultType] (BasicOpVisitorOfT 1 v, Node n) at System.Data.Query.InternalTrees.BasicOpVisitorOfT 1.VisitNode (Узел п) на System.Data.Query.PlanCompiler. JoinElimination.Process() в System.Data.Query.PlanCompiler.PlanCompiler.Compile (Список entitySets) в System.Data.EntityClient.EntityCommandDefinition..ctor (DbProviderFactory storeProviderFactory, DbCommandTree commandTree) --- Конец внутренняя ошибка стека исключений --- в System.Data.EntityClient.EntityCommandDefinition..ctor (DbProviderFactory storeProviderFactory, DbCommandTree commandTree) в System.Data.EntityClient.EntityProvider Services.CreateCommandDefinition (DbProviderFactory storeProviderFactory, DbCommandTree commandTree) на System.Data.EntityClient.EntityProviderServices.CreateDbCommandDefinition (DbProviderManifest providerManifest, DbCommandTree commandTree) на System.Data.Common.DbProviderServices.CreateCommandDefinition (DbCommandTree commandTree) в System.Data.Objects .Internal.ObjectQueryExecutionPlan.Prepare (ObjectContext контекст, DbQueryCommandTree дерево, тип ElementType, MergeOption MergeOption, Спан пролет, ReadOnlyCollection 1 compiledQueryParameters, AliasGenerator aliasGenerator) at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable 1 forMergeOption) на System.Data.Objects.ObjectQuery 1.GetResults(Nullable 1 forMergeOption) на System.Data.Objects.ObjectQuery 1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Collections.Generic.List 1..ctor (IEnumerable 1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable 1 источник) в MyProject.UIEntities.UserSession.SaveReadingSession (UserSession uiEntity, MyEntities дБ) в C: \ SRC \ MyProject \ MyBL \ UIEntities \ UserSession.cs: строка 130

Таким образом, любые идеи, что я нарушил?

+1

Мне очень нравится сообщение об ошибке «Leaking Predicates» - хорошо сделано для его поиска! – Rikalous

ответ

1

Ха, я обнаружил ответ, когда я отправлял вопрос! Проблема в том, что лямбда ...SelectMany(x2 => x.GrandchildThings)...

Конечно, это должно быть x2.GrandchildThings. Задача решена.

Смежные вопросы