{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/118","repository_url":"https://api.github.com/repos/aspnet/EntityFramework6","labels_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/118/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/118/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/118/events","html_url":"https://github.com/aspnet/EntityFramework6/issues/118","id":192547767,"number":118,"title":"Internal .NET Framework Data Provider error 1004, 0, CQT VarRef could not be resolved in the variable scope stack.","user":{"login":"springy76","id":16399318,"avatar_url":"https://avatars.githubusercontent.com/u/16399318?v=3","gravatar_id":"","url":"https://api.github.com/users/springy76","html_url":"https://github.com/springy76","followers_url":"https://api.github.com/users/springy76/followers","following_url":"https://api.github.com/users/springy76/following{/other_user}","gists_url":"https://api.github.com/users/springy76/gists{/gist_id}","starred_url":"https://api.github.com/users/springy76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/springy76/subscriptions","organizations_url":"https://api.github.com/users/springy76/orgs","repos_url":"https://api.github.com/users/springy76/repos","events_url":"https://api.github.com/users/springy76/events{/privacy}","received_events_url":"https://api.github.com/users/springy76/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-30T11:59:12Z","updated_at":"2016-11-30T11:59:12Z","closed_at":null,"body":"I have a standalone server application which uses one code-first EF model against multiple databases (=different connection strings).\r\n\r\nOn startup the server connects to all databases multithreaded in parallel and executes multiple initialization queries. Most of the time everything works without exceptions, but sometimes one or more (or all) connections throw this 1004 exception (see subject and below). It may affect any random query and the callstack is always the same. If I re-execute the the very same method at a later time within the very same process then it will succeed.\r\n\r\nIt is always the same:\r\nOuter exception [System.Data.Entity.Core.EntityCommandCompilationException]:\r\n\"An error occurred while preparing the command definition. See the inner exception for details.\"\r\nInner exception [System.InvalidOperationException]:\r\n\"Internal .NET Framework Data Provider error 1004, 0, CQT VarRef could not be resolved in the variable scope stack.\"\r\n\r\nCallstack of the outer exception:\r\n```\r\n   bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)\r\n   bei System.Data.Entity.Core.EntityClient.Internal.EntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree, DbInterceptionContext interceptionContext)\r\n   bei System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.CreateCommandDefinition(ObjectContext context, DbQueryCommandTree tree)\r\n   bei System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.Prepare(ObjectContext context, DbQueryCommandTree tree, Type elementType, MergeOption mergeOption, Boolean streaming, Span span, IEnumerable`1 compiledQueryParameters, AliasGenerator aliasGenerator)\r\n   bei System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)\r\n   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()\r\n   bei System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)\r\n   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()\r\n   bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)\r\n   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()\r\n   bei System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()\r\n   bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n```\r\n\r\nCallstack of the inner exception:\r\n```\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.ITreeGenerator.ResolveScope(DbVariableReferenceExpression e)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.ITreeGenerator.Visit(DbVariableReferenceExpression e)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.ITreeGenerator.Visit(DbPropertyExpression e)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.ITreeGenerator.Visit(DbNewInstanceExpression e)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.ITreeGenerator.VisitExprAsScalar(DbExpression expr)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.ITreeGenerator.Visit(DbRefExpression e)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.ITreeGenerator.GenerateDiscriminatedProject(DbProjectExpression e)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.ITreeGenerator..ctor(DbQueryCommandTree ctree, DiscriminatorMap discriminatorMap)\r\n   bei System.Data.Entity.Core.Mapping.ViewGeneration.GeneratedView.GetInternalTree(Command targetIqtCommand)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.ExpandView(ScanTableOp scanTableOp, IsOfOp& typeFilter)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.ProcessScanTable(Node scanTableNode, ScanTableOp scanTableOp, IsOfOp& typeFilter)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ScanTableOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(RelOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(FilterOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.VisitScalarOpDefault(ScalarOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.VisitNavPropertyOp(PropertyOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(PropertyOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.Visit(UnnestOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(RelOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ProjectOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.VisitScalarOpDefault(ScalarOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ExistsOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.VisitScalarOpDefault(ScalarOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ConditionalOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.VisitScalarOpDefault(ScalarOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ConditionalOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.VisitScalarOpDefault(ScalarOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ConditionalOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.VisitScalarOpDefault(ScalarOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ConditionalOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.VisitScalarOpDefault(ScalarOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ConditionalOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(RelOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(FilterOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(RelOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(ProjectOp op, Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n)\r\n   bei System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(Node n)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Process(Dictionary`2& tvfResultKeys)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Process(PlanCompiler planCompilerState, StructuredTypeInfo& typeInfo, Dictionary`2& tvfResultKeys)\r\n   bei System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Compile(List`1& providerCommands, ColumnMap& resultColumnMap, Int32& columnCount, Set`1& entitySets)\r\n   bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)\r\n```\r\n\r\nProvider is System.Data.SQLite (in different versions because I'm seeing this error for many months now)."}}
{"actor":{"display_login":"springy76"}}