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

Query: Include Collection group by reference throws exception #10974

Closed
smitpatel opened this issue Feb 15, 2018 · 14 comments
Closed

Query: Include Collection group by reference throws exception #10974

smitpatel opened this issue Feb 15, 2018 · 14 comments
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
Member

smitpatel commented Feb 15, 2018

In GearsOfWarQueryTestBase

        [ConditionalFact]
        public virtual void Include_collection_group_by_reference()
        {
            using (var context = CreateContext())
            {
                var query = context.Set<Gear>()
                    .Include(g => g.Weapons)
                    .GroupBy(g => g.Squad)
                    .ToList();
            }
        }
@smitpatel
Copy link
Member Author

Test 'Microsoft.EntityFrameworkCore.Query.GearsOfWarQuerySqlServerTest.Include_collection_group_by_reference' failed: System.InvalidOperationException : No coercion operator is defined between types 'System.Int32' and 'System.String'.
	at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
	at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method)
	at System.Linq.Expressions.Expression.Convert(Expression expression, Type type)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\ExpressionVisitors\SqlTranslatingExpressionVisitor.cs(825,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.SqlTranslatingExpressionVisitor.VisitUnary(UnaryExpression expression)
	at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor visitor)
	at Remotion.Linq.Parsing.ThrowingExpressionVisitor.Visit(Expression expression)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\ExpressionVisitors\SqlTranslatingExpressionVisitor.cs(119,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.SqlTranslatingExpressionVisitor.Visit(Expression expression)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\ExpressionVisitors\SqlTranslatingExpressionVisitor.cs(546,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.SqlTranslatingExpressionVisitor.ProcessComparisonExpression(BinaryExpression binaryExpression)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\ExpressionVisitors\SqlTranslatingExpressionVisitor.cs(165,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.SqlTranslatingExpressionVisitor.VisitBinary(BinaryExpression expression)
	at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
	at Remotion.Linq.Parsing.ThrowingExpressionVisitor.Visit(Expression expression)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\ExpressionVisitors\SqlTranslatingExpressionVisitor.cs(127,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.SqlTranslatingExpressionVisitor.Visit(Expression expression)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\RelationalQueryModelVisitor.cs(1562,0): at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.TryFlattenJoin(JoinClause joinClause, QueryModel queryModel, Int32 index, Int32 previousProjectionCount, ParameterExpression previousParameter, Dictionary`2 previousMapping)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\RelationalQueryModelVisitor.cs(587,0): at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.VisitJoinClause(JoinClause joinClause, QueryModel queryModel, Int32 index)
	at Remotion.Linq.Clauses.JoinClause.Accept(IQueryModelVisitor visitor, QueryModel queryModel, Int32 index)
	at Remotion.Linq.QueryModelVisitorBase.VisitBodyClauses(ObservableCollection`1 bodyClauses, QueryModel queryModel)
	at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore\Query\EntityQueryModelVisitor.cs(760,0): at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitQueryModel(QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\RelationalQueryModelVisitor.cs(292,0): at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.VisitQueryModel(QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\ExpressionVisitors\RelationalEntityQueryableExpressionVisitor.cs(76,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.RelationalEntityQueryableExpressionVisitor.VisitSubQuery(SubQueryExpression expression)
	at Remotion.Linq.Clauses.Expressions.SubQueryExpression.Accept(ExpressionVisitor visitor)
	at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
	D:\code\EntityFrameworkCore\src\EFCore\Query\ExpressionVisitors\ExpressionVisitorBase.cs(58,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.ExpressionVisitorBase.VisitLambda[T](Expression`1 node)
	at System.Linq.Expressions.Expression`1.Accept(ExpressionVisitor visitor)
	at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
	at System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider nodes)
	at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\ExpressionVisitors\RelationalEntityQueryableExpressionVisitor.cs(131,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.RelationalEntityQueryableExpressionVisitor.VisitMethodCall(MethodCallExpression node)
	at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
	at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
	at System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node)
	at System.Linq.Expressions.BlockExpression.Accept(ExpressionVisitor visitor)
	at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
	D:\code\EntityFrameworkCore\src\EFCore\Query\ExpressionVisitors\ExpressionVisitorBase.cs(58,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.ExpressionVisitorBase.VisitLambda[T](Expression`1 node)
	at System.Linq.Expressions.Expression`1.Accept(ExpressionVisitor visitor)
	at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
	at System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider nodes)
	at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\ExpressionVisitors\RelationalEntityQueryableExpressionVisitor.cs(131,0): at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.RelationalEntityQueryableExpressionVisitor.VisitMethodCall(MethodCallExpression node)
	at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
	at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
	D:\code\EntityFrameworkCore\src\EFCore\Query\EntityQueryModelVisitor.cs(1452,0): at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.ReplaceClauseReferences(Expression expression, IQuerySource querySource, Boolean inProjection)
	D:\code\EntityFrameworkCore\src\EFCore\Query\ResultOperatorHandler.cs(233,0): at Microsoft.EntityFrameworkCore.Query.ResultOperatorHandler.HandleGroup(EntityQueryModelVisitor entityQueryModelVisitor, GroupResultOperator groupResultOperator, QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore\Query\ResultOperatorHandler.cs(43,0): at Microsoft.EntityFrameworkCore.Query.ResultOperatorHandler.<>c.<.cctor>b__33_11(EntityQueryModelVisitor v, ResultOperatorBase r, QueryModel q)
	D:\code\EntityFrameworkCore\src\EFCore\Query\ResultOperatorHandler.cs(89,0): at Microsoft.EntityFrameworkCore.Query.ResultOperatorHandler.HandleResultOperator(EntityQueryModelVisitor entityQueryModelVisitor, ResultOperatorBase resultOperator, QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\Internal\RelationalResultOperatorHandler.cs(68,0): at Microsoft.EntityFrameworkCore.Query.Internal.RelationalResultOperatorHandler.HandlerContext.EvalOnClient(Boolean requiresClientResultOperator)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\Internal\RelationalResultOperatorHandler.cs(482,0): at Microsoft.EntityFrameworkCore.Query.Internal.RelationalResultOperatorHandler.HandleGroup(HandlerContext handlerContext)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\Internal\RelationalResultOperatorHandler.cs(160,0): at Microsoft.EntityFrameworkCore.Query.Internal.RelationalResultOperatorHandler.HandleResultOperator(EntityQueryModelVisitor entityQueryModelVisitor, ResultOperatorBase resultOperator, QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore\Query\EntityQueryModelVisitor.cs(1284,0): at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, Int32 index)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\RelationalQueryModelVisitor.cs(1217,0): at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, Int32 index)
	at Remotion.Linq.Clauses.ResultOperatorBase.Accept(IQueryModelVisitor visitor, QueryModel queryModel, Int32 index)
	at Remotion.Linq.QueryModelVisitorBase.VisitResultOperators(ObservableCollection`1 resultOperators, QueryModel queryModel)
	at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore\Query\EntityQueryModelVisitor.cs(760,0): at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitQueryModel(QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore.Relational\Query\RelationalQueryModelVisitor.cs(292,0): at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.VisitQueryModel(QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore\Query\EntityQueryModelVisitor.cs(175,0): at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)
	D:\code\EntityFrameworkCore\src\EFCore\Storage\Database.cs(70,0): at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](QueryModel queryModel)
	--- End of stack trace from previous location where exception was thrown ---
	at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	D:\code\EntityFrameworkCore\src\EFCore\Query\Internal\QueryCompiler.cs(150,0): at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](Expression query, IQueryModelGenerator queryModelGenerator, IDatabase database, IDiagnosticsLogger`1 logger, Type contextType)
	D:\code\EntityFrameworkCore\src\EFCore\Query\Internal\QueryCompiler.cs(91,0): at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass13_0`1.<Execute>b__0()
	D:\code\EntityFrameworkCore\src\EFCore\Query\Internal\CompiledQueryCache.cs(69,0): at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
	D:\code\EntityFrameworkCore\src\EFCore\Query\Internal\CompiledQueryCache.cs(44,0): at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
	D:\code\EntityFrameworkCore\src\EFCore\Query\Internal\QueryCompiler.cs(87,0): at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
	D:\code\EntityFrameworkCore\src\EFCore\Query\Internal\EntityQueryProvider.cs(62,0): at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
	at Remotion.Linq.QueryableBase`1.GetEnumerator()
	at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
	at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
	D:\code\EntityFrameworkCore\src\EFCore.Specification.Tests\Query\GearsOfWarQueryTestBase.cs(4223,0): at Microsoft.EntityFrameworkCore.Query.GearsOfWarQueryTestBase`1.Include_collection_group_by_reference()
	D:\code\EntityFrameworkCore\test\EFCore.SqlServer.FunctionalTests\Query\GearsOfWarQuerySqlServerTest.cs(5995,0): at Microsoft.EntityFrameworkCore.Query.GearsOfWarQuerySqlServerTest.Include_collection_group_by_reference()

Output from Microsoft.EntityFrameworkCore.Query.GearsOfWarQuerySqlServerTest.Include_collection_group_by_reference:
  Entity Framework Core 2.1.0-preview2-t000 initialized 'GearsOfWarContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: SensitiveDataLoggingEnabled MaxPoolSize=128 CommandTimeout=600
  
  Compiling query model: 
  '(from Gear g in DbSet<Gear>
  select [g])
  .Include("Weapons")
  .GroupBy([g].Squad, [g])'
  
  Including navigation: '[g].Weapons'
  
  Optimized query model: 
  '(from Gear g in DbSet<Gear>
  join Squad g.Squad in DbSet<Squad>
  on Property([g], "SquadId") equals Property([g.Squad], "Id")
  order by [g.Squad] asc, EF.Property(?[g]?, "FullName") asc
  select [g]).GroupBy([g.Squad], Gear _Include(
          queryContext: queryContext, 
          entity: [g], 
          included: new object[]{ }, 
          fixup: (QueryContext queryContext | Gear entity | object[] included) => 
          {
              return void queryContext.QueryBuffer.IncludeCollection(
                  includeId: 0, 
                  navigation: Gear.Weapons, 
                  inverseNavigation: Weapon.Owner, 
                  targetEntityType: EntityType: Weapon, 
                  clrCollectionAccessor: ClrICollectionAccessor<Gear, ICollection<Weapon>, Weapon>, 
                  inverseClrPropertySetter: ClrPropertySetter<Weapon, Gear>, 
                  tracking: False, 
                  instance: entity, 
                  valuesFactory: () => 
                      from Weapon g.Weapons in DbSet<Weapon>
                      join AnonymousObject _g in 
                          (from Gear g in DbSet<Gear>
                          join Squad g.Squad in DbSet<Squad>
                          on Property([g], "SquadId") equals Property([g.Squad], "Id")
                          select new AnonymousObject(new object[]
                              { 
                                  (object)EF.Property(?[g]?, "FullName"), 
                                  (object)[g.Squad] 
                              })).Distinct()
                      on Property([g.Weapons], "OwnerFullName") equals (string)object [_g].GetValue(0)
                      order by object [_g].GetValue(1) asc, object [_g].GetValue(0) asc
                      select [g.Weapons], 
                  joinPredicate: (Gear p | Weapon d) => d.OwnerFullName == default(string) ? False : p.FullName == d.OwnerFullName)
          }
      ))'

0 passed, 1 failed, 0 skipped, took 4.46 seconds (xUnit.net 2.3.1 build 3858).

@maumar
Copy link
Contributor

maumar commented Mar 9, 2018

problem is that we add orderby group key clause to the query. When we compile include we project order by clauses in the inner query (one being qsre). We should optimize group by entity, to group by entity key instead.

@maumar maumar assigned smitpatel and unassigned maumar Mar 9, 2018
@maumar
Copy link
Contributor

maumar commented Mar 9, 2018

assigning to @smitpatel since he is working on entity equality improvement currently

@smitpatel
Copy link
Member Author

smitpatel commented Mar 9, 2018

Hold on!
We cannot convert group by entity to group by entity key, if we have to return back the groups.

@maumar
Copy link
Contributor

maumar commented Mar 9, 2018

Ah right, I guess we can just recognize we are about to order by qsre and order by key instead.

@smitpatel
Copy link
Member Author

Further entity equality deals with equality only and wouldn't process just a qsre in ordering. Perhaps include pipeline at some place needs to convert QSRE to key access while constructing collection query model since AnonymousObject cannot hold a qsre.

@maumar maumar assigned maumar and unassigned smitpatel Mar 9, 2018
@maumar
Copy link
Contributor

maumar commented Mar 9, 2018

or we could do that broadly, in OptimizeQueryModel - we just need to convert orderby qsre into orderby pk before RewriteCollectionQueries

@smitpatel
Copy link
Member Author

We can certainly do that more broadly. Right now we have piece of code in SqlTranslatingExpressionVisitor which translates QSRE to PK access when not in projection. Perhaps we could evaluate that code path and convert those to PK access during QM rewrite itself.

@smitpatel
Copy link
Member Author

@maumar - #11022 seems same as that but for join key selector case.

maumar added a commit that referenced this issue Mar 15, 2018
#11022 - GroupJoin with an entity object as a key fails
#10974 - Query: Include Collection group by reference throws exception
#11245 - Query: compilation error for queries with join where the inner key is navigation

- Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join,
- Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end),
- Improved "requires materialization" logic to correctly mark qsre projected out of subquery that is a result of nav rewrite of join/groupjoin inner key.
maumar added a commit that referenced this issue Mar 15, 2018
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation
#10974 - Query: Include Collection group by reference throws exception
#11245 - Query: compilation error for queries with join where the inner key is navigation

- Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join,
- Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end),
- Improved "requires materialization" logic to correctly mark qsre projected out of subquery that is a result of nav rewrite of join/groupjoin inner key.
maumar added a commit that referenced this issue Mar 15, 2018
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation
#10974 - Query: Include Collection group by reference throws exception
#11245 - Query: compilation error for queries with join where the inner key is navigation
#9481 - EF Core joining on the wrong field when using GroupBy

- Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join,
- Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end),
- Improved "requires materialization" logic to correctly mark qsre projected out of subquery that is a result of nav rewrite of join/groupjoin inner key.
maumar added a commit that referenced this issue Mar 16, 2018
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation
#10974 - Query: Include Collection group by reference throws exception
#11245 - Query: compilation error for queries with join where the inner key is navigation
#11022 - Query: GroupJoin with a complex join key fails during compilation
#9481 - EF Core joining on the wrong field when using GroupBy

- Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join,
- Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end),
- Improved "requires materialization" logic to correctly mark for materialization query sources coming from subquery join keys.
maumar added a commit that referenced this issue Mar 19, 2018
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation
#10974 - Query: Include Collection group by reference throws exception
#11245 - Query: compilation error for queries with join where the inner key is navigation
#11022 - Query: GroupJoin with a complex join key fails during compilation
#9481 - EF Core joining on the wrong field when using GroupBy

- Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join,
- Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end),
- Improved "requires materialization" logic to correctly mark for materialization query sources coming from subquery join keys.
maumar added a commit that referenced this issue Mar 20, 2018
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation
#10974 - Query: Include Collection group by reference throws exception
#11245 - Query: compilation error for queries with join where the inner key is navigation
#11022 - Query: GroupJoin with a complex join key fails during compilation
#9481 - EF Core joining on the wrong field when using GroupBy

- Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join,
- Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end),
- Improved "requires materialization" logic to correctly mark for materialization query sources coming from subquery join keys.
maumar added a commit that referenced this issue Mar 20, 2018
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation
#10974 - Query: Include Collection group by reference throws exception
#11245 - Query: compilation error for queries with join where the inner key is navigation
#11022 - Query: GroupJoin with a complex join key fails during compilation
#9481 - EF Core joining on the wrong field when using GroupBy

- Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join,
- Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end),
- Improved "requires materialization" logic to correctly mark for materialization query sources coming from subquery join keys.
@maumar
Copy link
Contributor

maumar commented Mar 20, 2018

fixed in fdb8ece

@maumar maumar closed this as completed Mar 20, 2018
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Mar 20, 2018
@ajcvickers
Copy link
Member

Reopening because there is still a failing test (Include_collection_group_by_reference) referencing this issue.

@ajcvickers ajcvickers reopened this Aug 9, 2019
@ajcvickers ajcvickers removed this from the 2.1.0-preview2 milestone Aug 9, 2019
@ajcvickers
Copy link
Member

System.InvalidOperationException : Operation is not valid due to the current state of the object.
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateGroupBy(ShapedQueryExpression source, LambdaExpression keySelector, LambdaExpression elementSelector, LambdaExpression resultSelector) in C:\aspnet\EntityFrameworkCore\src\EFCore.Relational\Query\RelationalQueryableMethodTranslatingExpressionVisitor.cs:line 337
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\QueryableMethodTranslatingExpressionVisitor.cs:line 161
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) in C:\aspnet\EntityFrameworkCore\src\EFCore.Relational\Query\RelationalQueryableMethodTranslatingExpressionVisitor.cs:line 74
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query) in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\QueryCompilationContext.cs:line 68
   at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async) in C:\aspnet\EntityFrameworkCore\src\EFCore\Storage\Database.cs:line 71
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async) in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\Internal\QueryCompiler.cs:line 106
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass9_0`1.<Execute>b__0() in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\Internal\QueryCompiler.cs:line 96
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler) in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\Internal\CompiledQueryCache.cs:line 84
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler) in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\Internal\CompiledQueryCache.cs:line 59
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query) in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\Internal\QueryCompiler.cs:line 92
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\Internal\EntityQueryProvider.cs:line 79
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetEnumerator() in C:\aspnet\EntityFrameworkCore\src\EFCore\Query\Internal\EntityQueryable`.cs:line 94
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.EntityFrameworkCore.Query.GearsOfWarQueryTestBase`1.Include_collection_group_by_reference() in C:\aspnet\EntityFrameworkCore\test\EFCore.Specification.Tests\Query\GearsOfWarQueryTestBase.cs:line 5676
   at Microsoft.EntityFrameworkCore.Query.GearsOfWarQuerySqlServerTest.Include_collection_group_by_reference() in C:\aspnet\EntityFrameworkCore\test\EFCore.SqlServer.FunctionalTests\Query\GearsOfWarQuerySqlServerTest.cs:line 5563

@ajcvickers
Copy link
Member

@smitpatel to follow up.

@smitpatel
Copy link
Member Author

Duplicate of #17068

@smitpatel smitpatel marked this as a duplicate of #17068 Aug 12, 2019
@smitpatel smitpatel added this to the 2.1.0-preview2 milestone Aug 12, 2019
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview2, 2.1.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

No branches or pull requests

3 participants