Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nav expansion throw for eager loaded include on derived type when projection has anonymous type #16622

Closed
smitpatel opened this issue Jul 16, 2019 · 0 comments · Fixed by #16890
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@smitpatel
Copy link
Contributor

        [ConditionalFact]
        public virtual void Navigation_rewrite_on_owned_reference_followed_by_regular_entity_filter()
        {
            using (var ctx = CreateContext())
            {
                var query = ctx.Set<OwnedPerson>().Where(p => p.PersonAddress.Country.Planet.Id != 7).Select(p => new { p });
                var result = query.ToList();

                Assert.Equal(4, result.Count);
            }
        }

throws

Message: 
    System.ArgumentException : 'BranchAddress' is not a member of type 'Microsoft.EntityFrameworkCore.Query.OwnedQueryTestBase`1+OwnedPerson[Microsoft.EntityFrameworkCore.Query.OwnedQuerySqlServerTest+OwnedQuerySqlServerFixture]' (Parameter 'propertyOrFieldName')
  Stack Trace: 
    at Expression.PropertyOrField(Expression expression, String propertyOrFieldName)
    at ExpressionExtensions.BuildPropertyAccess(Expression root, List`1 path, List`1 navigations) in ExpressionExtensions.cs line: 380
    at NavigationPropertyUnbindingVisitor.VisitExtension(Expression extensionExpression) in NavigationPropertyUnbindingVisitor.cs line: 36
    at Expression.Accept(ExpressionVisitor visitor)
    at ExpressionVisitor.Visit(Expression node)
    at IncludeExpression.VisitChildren(ExpressionVisitor visitor) in IncludeExpression.cs line: 32
    at ExpressionVisitor.VisitExtension(Expression node)
    at NavigationPropertyUnbindingVisitor.VisitExtension(Expression extensionExpression) in NavigationPropertyUnbindingVisitor.cs line: 63
    at Expression.Accept(ExpressionVisitor visitor)
    at ExpressionVisitor.Visit(Expression node)
    at IncludeExpression.VisitChildren(ExpressionVisitor visitor) in IncludeExpression.cs line: 33
    at ExpressionVisitor.VisitExtension(Expression node)
    at NavigationPropertyUnbindingVisitor.VisitExtension(Expression extensionExpression) in NavigationPropertyUnbindingVisitor.cs line: 63
    at Expression.Accept(ExpressionVisitor visitor)
    at ExpressionVisitor.Visit(Expression node)
    at IncludeExpression.VisitChildren(ExpressionVisitor visitor) in IncludeExpression.cs line: 32
    at ExpressionVisitor.VisitExtension(Expression node)
    at NavigationPropertyUnbindingVisitor.VisitExtension(Expression extensionExpression) in NavigationPropertyUnbindingVisitor.cs line: 63
    at Expression.Accept(ExpressionVisitor visitor)
    at ExpressionVisitor.Visit(Expression node)
    at IncludeExpression.VisitChildren(ExpressionVisitor visitor) in IncludeExpression.cs line: 32
    at ExpressionVisitor.VisitExtension(Expression node)
    at NavigationPropertyUnbindingVisitor.VisitExtension(Expression extensionExpression) in NavigationPropertyUnbindingVisitor.cs line: 63
    at Expression.Accept(ExpressionVisitor visitor)
    at ExpressionVisitor.Visit(Expression node)
    at ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes)
    at ExpressionVisitor.VisitNew(NewExpression node)
    at NewExpression.Accept(ExpressionVisitor visitor)
    at ExpressionVisitor.Visit(Expression node)
    at ExpressionVisitor.VisitLambda[T](Expression`1 node)
    at Expression`1.Accept(ExpressionVisitor visitor)
    at ExpressionVisitor.Visit(Expression node)
    at NavigationExpansionReducingVisitor.VisitExtension(Expression extensionExpression) in NavigationExpansionReducingVisitor.cs line: 55
    at Expression.Accept(ExpressionVisitor visitor)
    at ExpressionVisitor.Visit(Expression node)
    at QueryOptimizer.Visit(Expression query) in QueryOptimizingExpressionVisitor.cs line: 28
    at QueryCompilationContext.CreateQueryExecutor[TResult](Expression query) in QueryCompilationContext.cs line: 71
    at Database.CompileQuery[TResult](Expression query, Boolean async) in Database.cs line: 72
    at QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async) in QueryCompiler.cs line: 108
    at <>c__DisplayClass9_0`1.<Execute>b__0() in QueryCompiler.cs line: 97
    at CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler) in CompiledQueryCache.cs line: 84
    at CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler) in CompiledQueryCache.cs line: 59
    at QueryCompiler.Execute[TResult](Expression query) in QueryCompiler.cs line: 93
    at EntityQueryProvider.Execute[TResult](Expression expression) in EntityQueryProvider.cs line: 79
    at EntityQueryable`1.GetEnumerator() in EntityQueryable`.cs line: 94
    at List`1.ctor(IEnumerable`1 collection)
    at Enumerable.ToList[TSource](IEnumerable`1 source)
    at OwnedQueryTestBase`1.Navigation_rewrite_on_owned_reference_followed_by_regular_entity_filter() in OwnedQueryTestBase.cs line: 316
    at OwnedQuerySqlServerTest.Navigation_rewrite_on_owned_reference_followed_by_regular_entity_filter() in OwnedQuerySqlServerTest.cs line: 651
@ajcvickers ajcvickers added this to the 3.0.0 milestone Jul 19, 2019
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 1, 2019
smitpatel added a commit that referenced this issue Aug 1, 2019
Fixed by new nav rewrite

Resolves #16622
smitpatel added a commit that referenced this issue Aug 1, 2019
Fixed by new nav rewrite

Resolves #16622
smitpatel added a commit that referenced this issue Aug 1, 2019
Fixed by new nav rewrite

Resolves #16622
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview9 Aug 21, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview9, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants