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: compilation error for queries with collection include and concat #12889

Closed
maumar opened this issue Aug 3, 2018 · 2 comments · Fixed by #17766
Closed

Query: compilation error for queries with collection include and concat #12889

maumar opened this issue Aug 3, 2018 · 2 comments · Fixed by #17766
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. punted-for-3.0 type-bug

Comments

@maumar
Copy link
Contributor

maumar commented Aug 3, 2018

query:

                var query = ctx.Gears.Include(g => g.Weapons).Concat(ctx.Gears);
                var result = query.ToList();

exception:

The input sequence must have items of type 'Microsoft.EntityFrameworkCore.TestModels.GearsOfWarModel.Gear', but it has items of type 'Microsoft.EntityFrameworkCore.Query.Internal.AnonymousObject'.
Parameter name: inputInfo
	at Remotion.Linq.Clauses.ResultOperatorBase.CheckSequenceItemType(StreamedSequenceInfo inputInfo, Type expectedItemType)
	at Remotion.Linq.Clauses.ResultOperators.ConcatResultOperator.GetOutputDataInfo(IStreamedDataInfo inputInfo)
	at Remotion.Linq.QueryModel.<GetOutputDataInfo>b__0(IStreamedDataInfo current, ResultOperatorBase resultOperator)
	at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
	at Remotion.Linq.QueryModel.GetOutputDataInfo()
	at Remotion.Linq.Clauses.Expressions.SubQueryExpression..ctor(QueryModel queryModel)
	at Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler.CollectionQueryModelRewritingExpressionVisitor.CreateJoinToParentQuery(QueryModel parentQueryModel, QuerySourceReferenceExpression parentQuerySourceReferenceExpression, Expression outerTargetExpression, IForeignKey foreignKey, QueryModel targetQueryModel, ICollection`1 subQueryProjection)
	at Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler.CollectionQueryModelRewritingExpressionVisitor.Rewrite(QueryModel collectionQueryModel, INavigation navigation)
	at Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler.CollectionQueryModelRewritingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
	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)
	at System.Linq.Expressions.ExpressionVisitor.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)
	at Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler.CollectionQueryModelRewritingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
	at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
	at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
	at Remotion.Linq.Clauses.SelectClause.TransformExpressions(Func`2 transformation)
	at Remotion.Linq.QueryModel.TransformExpressions(Func`2 transformation)
	at Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler.RewriteCollectionQueries(QueryModel queryModel)
	at Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler.RewriteCollectionQueries()
	at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.OptimizeQueryModel(QueryModel queryModel, Boolean asyncQuery)
	at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.OptimizeQueryModel(QueryModel queryModel, Boolean asyncQuery)
	at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)
	at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](QueryModel queryModel)
@ajcvickers ajcvickers added this to the 3.0.0 milestone Aug 3, 2018
@maumar
Copy link
Contributor Author

maumar commented Aug 3, 2018

same goes for union

@ajcvickers ajcvickers modified the milestones: 3.0.0, Backlog Jun 28, 2019
@smitpatel smitpatel removed this from the Backlog milestone Sep 10, 2019
@smitpatel smitpatel added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Sep 10, 2019
@smitpatel
Copy link
Contributor

We don't allow different include on both sides of Set operations. Either specify same includes or do include after applying set operation.

smitpatel added a commit that referenced this issue Sep 11, 2019
Covers EFCore.Specs.Tests Query folder

Resolves #8366
Resolves #8582
Resolves #8722
Resolves #9007
Resolves #9254
Resolves #12574
Resolves #12579
Resolves #12598
Resolves #12786
Resolves #12787
Resolves #12794
Resolves #12806
Resolves #12827
Resolves #12873
Resolves #14900
Resolves #15862
Resolves #16157
Resolves #17240
Resolves #17243


Close #12889
Close #17243
smitpatel added a commit that referenced this issue Sep 11, 2019
Covers EFCore.Specs.Tests Query folder

Resolves #8366
Resolves #8582
Resolves #8722
Resolves #9007
Resolves #9254
Resolves #12574
Resolves #12579
Resolves #12598
Resolves #12786
Resolves #12787
Resolves #12794
Resolves #12806
Resolves #12827
Resolves #12873
Resolves #14900
Resolves #15862
Resolves #16157
Resolves #17240


Close #12889
Close #17243
smitpatel added a commit that referenced this issue Sep 11, 2019
Covers EFCore.Specs.Tests Query folder

Resolves #8366
Resolves #8582
Resolves #8722
Resolves #9007
Resolves #9254
Resolves #12574
Resolves #12579
Resolves #12598
Resolves #12786
Resolves #12787
Resolves #12794
Resolves #12806
Resolves #12827
Resolves #12873
Resolves #14900
Resolves #15862
Resolves #16157
Resolves #17240


Close #12889
Close #17243
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. punted-for-3.0 type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants