{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7280","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7280/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7280/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7280/events","html_url":"https://github.com/aspnet/EntityFramework/issues/7280","id":196677538,"number":7280,"title":"Upcast-Concat throws ArgumentException","user":{"login":"azabluda","id":7567733,"avatar_url":"https://avatars.githubusercontent.com/u/7567733?v=3","gravatar_id":"","url":"https://api.github.com/users/azabluda","html_url":"https://github.com/azabluda","followers_url":"https://api.github.com/users/azabluda/followers","following_url":"https://api.github.com/users/azabluda/following{/other_user}","gists_url":"https://api.github.com/users/azabluda/gists{/gist_id}","starred_url":"https://api.github.com/users/azabluda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azabluda/subscriptions","organizations_url":"https://api.github.com/users/azabluda/orgs","repos_url":"https://api.github.com/users/azabluda/repos","events_url":"https://api.github.com/users/azabluda/events{/privacy}","received_events_url":"https://api.github.com/users/azabluda/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-20T13:51:20Z","updated_at":"2016-12-20T13:51:20Z","closed_at":null,"body":"`Concat` of two upcasted collections fails with `ArgumentException`.\r\n\r\n```\r\nException message:\r\nSystem.ArgumentException\r\nExpression of type 'System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Storage.ValueBuffer]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Specification.Tests.TestModels.Inheritance.Kiwi]' of method 'System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Specification.Tests.TestModels.Inheritance.Kiwi] Concat[Kiwi](System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Specification.Tests.TestModels.Inheritance.Kiwi], System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Specification.Tests.TestModels.Inheritance.Kiwi])'\r\n\r\nStack trace:\r\n   at System.Linq.Expressions.Expression.ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arg, ParameterInfo pi)\r\n   at System.Linq.Expressions.Expression.Call(MethodInfo method, Expression arg0, Expression arg1)\r\n   at Microsoft.EntityFrameworkCore.Query.ResultOperatorHandler.HandleSetOperation(EntityQueryModelVisitor entityQueryModelVisitor, Expression secondSource, MethodInfo setMethodInfo) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\ResultOperatorHandler.cs:line 331\r\n   at Microsoft.EntityFrameworkCore.Query.ResultOperatorHandler.HandleConcat(EntityQueryModelVisitor entityQueryModelVisitor, ConcatResultOperator concatResultOperator) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\ResultOperatorHandler.cs:line 133\r\n   at Microsoft.EntityFrameworkCore.Query.ResultOperatorHandler.<>c.<.cctor>b__30_4(EntityQueryModelVisitor v, ResultOperatorBase r, QueryModel __) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\ResultOperatorHandler.cs:line 33\r\n   at Microsoft.EntityFrameworkCore.Query.ResultOperatorHandler.HandleResultOperator(EntityQueryModelVisitor entityQueryModelVisitor, ResultOperatorBase resultOperator, QueryModel queryModel) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\ResultOperatorHandler.cs:line 78\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalResultOperatorHandler.HandlerContext.EvalOnClient(Boolean requiresClientResultOperator) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore.Relational\\Query\\Internal\\RelationalResultOperatorHandler.cs:line 71\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalResultOperatorHandler.HandleResultOperator(EntityQueryModelVisitor entityQueryModelVisitor, ResultOperatorBase resultOperator, QueryModel queryModel) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore.Relational\\Query\\Internal\\RelationalResultOperatorHandler.cs:line 168\r\n   at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, Int32 index) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\EntityQueryModelVisitor.cs:line 1077\r\n   at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, Int32 index) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore.Relational\\Query\\RelationalQueryModelVisitor.cs:line 1187\r\n   at Remotion.Linq.QueryModelVisitorBase.VisitResultOperators(ObservableCollection`1 resultOperators, QueryModel queryModel)\r\n   at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitQueryModel(QueryModel queryModel) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\EntityQueryModelVisitor.cs:line 721\r\n   at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.VisitQueryModel(QueryModel queryModel) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore.Relational\\Query\\RelationalQueryModelVisitor.cs:line 373\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.SqlServerQueryModelVisitor.VisitQueryModel(QueryModel queryModel) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore.SqlServer\\Query\\Internal\\SqlServerQueryModelVisitor.cs:line 92\r\n   at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\EntityQueryModelVisitor.cs:line 259\r\n   at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](QueryModel queryModel) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Storage\\Database.cs:line 67\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](Expression query, INodeTypeProvider nodeTypeProvider, IDatabase database, ILogger logger, Type contextType) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\Internal\\QueryCompiler.cs:line 218\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass19_0`1.<CompileQuery>b__0() in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\Internal\\QueryCompiler.cs:line 171\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\Internal\\CompiledQueryCache.cs:line 68\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\Internal\\CompiledQueryCache.cs:line 45\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQuery[TResult](Expression query) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\Internal\\QueryCompiler.cs:line 169\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\Internal\\QueryCompiler.cs:line 99\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore\\Query\\Internal\\EntityQueryProvider.cs:line 57\r\n   at Remotion.Linq.QueryableBase`1.GetEnumerator()\r\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at Microsoft.EntityFrameworkCore.Specification.Tests.InheritanceTestBase`1.Can_concat_kiwis_and_eagles_as_birds() in D:\\EntityFramework\\src\\Microsoft.EntityFrameworkCore.Specification.Tests\\InheritanceTestBase.cs:line 282\r\n```\r\n\r\n### Steps to reproduce\r\nAdd the following test to `Microsoft.EntityFrameworkCore.Specification.Tests.InheritanceTestBase<TFixture>` and run it against SqlServer or InMemory database\r\n\r\n```c#\r\n        [Fact]\r\n        public virtual void Can_concat_kiwis_and_eagles_as_birds()\r\n        {\r\n            using (var context = CreateContext())\r\n            {\r\n                var kiwis = context.Set<Kiwi>()\r\n                    .Where(x => true); // dummy Where condition, see https://github.com/aspnet/EntityFramework/issues/7279\r\n\r\n                var eagles = context.Set<Eagle>()\r\n                    .Where(x => true); // dummy Where condition, see https://github.com/aspnet/EntityFramework/issues/7279\r\n\r\n                var concat = kiwis.Cast<Bird>().Concat(eagles).ToList(); // <<< ArgumentException\r\n\r\n                Assert.Equal(2, concat.Count);\r\n            }\r\n        }\r\n```\r\nNote that `.Where(x => true)` clauses are only necessary because of #7279.\r\n\r\n### Further technical details\r\nEF Core version: 1.1.0\r\nDatabase Provider: Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.InMemory\r\nOperating system: Windows 7 Professional SP1\r\nIDE: Visual Studio 2015\r\n"}}
{"actor":{"display_login":"azabluda"}}