{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6195","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6195/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6195/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6195/events","html_url":"https://github.com/aspnet/EntityFramework/issues/6195","id":168097561,"number":6195,"title":"Simple query fails - with test case","user":{"login":"dazinator","id":3176632,"avatar_url":"https://avatars.githubusercontent.com/u/3176632?v=3","gravatar_id":"","url":"https://api.github.com/users/dazinator","html_url":"https://github.com/dazinator","followers_url":"https://api.github.com/users/dazinator/followers","following_url":"https://api.github.com/users/dazinator/following{/other_user}","gists_url":"https://api.github.com/users/dazinator/gists{/gist_id}","starred_url":"https://api.github.com/users/dazinator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dazinator/subscriptions","organizations_url":"https://api.github.com/users/dazinator/orgs","repos_url":"https://api.github.com/users/dazinator/repos","events_url":"https://api.github.com/users/dazinator/events{/privacy}","received_events_url":"https://api.github.com/users/dazinator/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-28T13:38:03Z","updated_at":"2016-07-28T18:02:44Z","closed_at":"2016-07-28T18:02:44Z","body":"### Steps to reproduce\r\n\r\nUsing the `InMemory` store , here is a simple xunit test case to reproduce the problem (using xunit)\r\n\r\n```csharp\r\n\r\n    public class EFGitHubIssue6195\r\n    {\r\n\r\n        private Issue6195DbContext _db;\r\n        \r\n        public EFGitHubIssue6195()\r\n        {\r\n            var optionsBuilder = new DbContextOptionsBuilder<Issue6195DbContext>();\r\n            // Create an in memory database for unit testing.\r\n            optionsBuilder.UseInMemoryDatabase();\r\n            _db = new Issue6195DbContext(optionsBuilder.Options);\r\n        }\r\n\r\n        [Fact]\r\n        public void Reproduce()\r\n        {\r\n            int entityBId = 1;\r\n            var dataObjectQuery = _db.EntityA.Where(c => c.EntityC != null && c.EntityC.IsActive);\r\n            var boom = dataObjectQuery.ToArray();\r\n\r\n        }\r\n\r\n    }\r\n\r\n    public class Issue6195DbContext : DbContext\r\n    {\r\n\r\n        public Issue6195DbContext(DbContextOptions<Issue6195DbContext> options) : base(options)\r\n        {\r\n\r\n        }\r\n\r\n        protected override void OnModelCreating(ModelBuilder modelBuilder)\r\n        {\r\n\r\n            modelBuilder.Entity<EntityA>(entity =>\r\n            {\r\n\r\n            });\r\n\r\n            modelBuilder.Entity<EntityC>(entity =>\r\n            {\r\n               \r\n            });\r\n          \r\n        }\r\n\r\n        public virtual DbSet<EntityA> EntityA { get; set; }\r\n     \r\n        public virtual DbSet<EntityC> EntityC { get; set; }\r\n    }\r\n\r\n    public class EntityA\r\n    {\r\n        public int EntityAId { get; set; }\r\n\r\n        public int? EntityCId { get; set; }\r\n        public virtual EntityC EntityC { get; set; }\r\n    }\r\n\r\n    public class EntityC\r\n    {\r\n        public EntityC()\r\n        {\r\n            EntityA = new HashSet<EntityA>();\r\n        }\r\n\r\n        public int EntityCId { get; set; }\r\n\r\n        public bool IsActive { get; set; }\r\n\r\n        public virtual ICollection<EntityA> EntityA { get; set; }\r\n\r\n    }\r\n\r\n```\r\n\r\nException message:\r\n\r\n```\r\nExpression of type 'System.Func`2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Reach.Business.Tests.EntityA,System.Collections.Generic.IEnumerable`1[Reach.Business.Tests.EntityC]],Reach.Business.Tests.EntityC],System.Nullable`1[System.Boolean]]' cannot be used for parameter of type 'System.Func`2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Reach.Business.Tests.EntityA,System.Collections.Generic.IEnumerable`1[Reach.Business.Tests.EntityC]],Reach.Business.Tests.EntityC],System.Boolean]' of method 'System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Reach.Business.Tests.EntityA,System.Collections.Generic.IEnumerable`1[Reach.Business.Tests.EntityC]],Reach.Business.Tests.EntityC]] _Where[TransparentIdentifier`2](System.Collections.Generic.IEnumerable`1[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Reach.Business.Tests.EntityA,System.Collections.Generic.IEnumerable`1[Reach.Business.Tests.EntityC]],Reach.Business.Tests.EntityC]], System.Func`2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor+TransparentIdentifier`2[Reach.Business.Tests.EntityA,System.Collections.Generic.IEnumerable`1[Reach.Business.Tests.EntityC]],Reach.Business.Tests.EntityC],System.Boolean])'\r\n```\r\n\r\nStack trace:\r\n```\r\nat 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.EntityQueryModelVisitor.VisitWhereClause(WhereClause whereClause, QueryModel queryModel, Int32 index)\r\n   at Remotion.Linq.QueryModelVisitorBase.VisitBodyClauses(ObservableCollection`1 bodyClauses, QueryModel queryModel)\r\n   at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)\r\n   at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitQueryModel(QueryModel queryModel)\r\n   at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)\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.<>c__DisplayClass19_0`1.<CompileQuery>b__0()\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)\r\n   at Remotion.Linq.QueryableBase`1.GetEnumerator()\r\n   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\r\n  at Reach.GCv3.Business.Tests.EFGitHubIssue6195.Reproduce() in C:\\Users\\darrell.tunnell\\Source\\Repos\\gc3-website\\src\r\n```\r\n\r\n### Further technical details\r\n\r\nEF Core version: 1.0.0\r\nOperating system: Windows 8.1 Enterprise N\r\nVisual Studio version: VS2015 Update 3\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/235975701","html_url":"https://github.com/aspnet/EntityFramework/issues/6195#issuecomment-235975701","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6195","id":235975701,"user":{"login":"maumar","id":1591930,"avatar_url":"https://avatars.githubusercontent.com/u/1591930?v=3","gravatar_id":"","url":"https://api.github.com/users/maumar","html_url":"https://github.com/maumar","followers_url":"https://api.github.com/users/maumar/followers","following_url":"https://api.github.com/users/maumar/following{/other_user}","gists_url":"https://api.github.com/users/maumar/gists{/gist_id}","starred_url":"https://api.github.com/users/maumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maumar/subscriptions","organizations_url":"https://api.github.com/users/maumar/orgs","repos_url":"https://api.github.com/users/maumar/repos","events_url":"https://api.github.com/users/maumar/events{/privacy}","received_events_url":"https://api.github.com/users/maumar/received_events","type":"User","site_admin":false},"created_at":"2016-07-28T18:02:44Z","updated_at":"2016-07-28T18:02:44Z","body":"This is fixed in the current dev (and I verified in was broken in RTM). Workaround is to add == true to the bool property like so:\r\n\r\n```cs\r\n_db.EntityA.Where(c => c.EntityC != null && c.EntityC.IsActive == true);\r\n```"}}
{"actor":{"display_login":"maumar"}}