{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12667","repository_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore","labels_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12667/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12667/comments","events_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12667/events","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/12667","id":341115095,"node_id":"MDU6SXNzdWUzNDExMTUwOTU=","number":12667,"title":"Warning when query materializes an entity outside the top projection","user":{"login":"divega","id":1253414,"node_id":"MDQ6VXNlcjEyNTM0MTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1253414?v=4","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"labels":[{"id":76481854,"node_id":"MDU6TGFiZWw3NjQ4MTg1NA==","url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/labels/type-enhancement","name":"type-enhancement","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":{"login":"smitpatel","id":1528107,"node_id":"MDQ6VXNlcjE1MjgxMDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1528107?v=4","gravatar_id":"","url":"https://api.github.com/users/smitpatel","html_url":"https://github.com/smitpatel","followers_url":"https://api.github.com/users/smitpatel/followers","following_url":"https://api.github.com/users/smitpatel/following{/other_user}","gists_url":"https://api.github.com/users/smitpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/smitpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smitpatel/subscriptions","organizations_url":"https://api.github.com/users/smitpatel/orgs","repos_url":"https://api.github.com/users/smitpatel/repos","events_url":"https://api.github.com/users/smitpatel/events{/privacy}","received_events_url":"https://api.github.com/users/smitpatel/received_events","type":"User","site_admin":false},"assignees":[{"login":"smitpatel","id":1528107,"node_id":"MDQ6VXNlcjE1MjgxMDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1528107?v=4","gravatar_id":"","url":"https://api.github.com/users/smitpatel","html_url":"https://github.com/smitpatel","followers_url":"https://api.github.com/users/smitpatel/followers","following_url":"https://api.github.com/users/smitpatel/following{/other_user}","gists_url":"https://api.github.com/users/smitpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/smitpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smitpatel/subscriptions","organizations_url":"https://api.github.com/users/smitpatel/orgs","repos_url":"https://api.github.com/users/smitpatel/repos","events_url":"https://api.github.com/users/smitpatel/events{/privacy}","received_events_url":"https://api.github.com/users/smitpatel/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/milestones/42","html_url":"https://github.com/aspnet/EntityFrameworkCore/milestone/42","labels_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/milestones/42/labels","id":3349333,"node_id":"MDk6TWlsZXN0b25lMzM0OTMzMw==","number":42,"title":"3.0.0","description":"","creator":{"login":"bricelam","id":1226749,"node_id":"MDQ6VXNlcjEyMjY3NDk=","avatar_url":"https://avatars2.githubusercontent.com/u/1226749?v=4","gravatar_id":"","url":"https://api.github.com/users/bricelam","html_url":"https://github.com/bricelam","followers_url":"https://api.github.com/users/bricelam/followers","following_url":"https://api.github.com/users/bricelam/following{/other_user}","gists_url":"https://api.github.com/users/bricelam/gists{/gist_id}","starred_url":"https://api.github.com/users/bricelam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bricelam/subscriptions","organizations_url":"https://api.github.com/users/bricelam/orgs","repos_url":"https://api.github.com/users/bricelam/repos","events_url":"https://api.github.com/users/bricelam/events{/privacy}","received_events_url":"https://api.github.com/users/bricelam/received_events","type":"User","site_admin":false},"open_issues":124,"closed_issues":0,"state":"open","created_at":"2018-05-15T17:11:08Z","updated_at":"2018-07-17T18:54:53Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2018-07-13T18:22:01Z","updated_at":"2018-07-20T18:04:12Z","closed_at":null,"author_association":"MEMBER","body":"One example of when this may happen is if an opaque method that takes an entity as an argument is invoked in the Where clause, e.g.:\r\n\r\n``` c#\r\nvar query = context.People\r\n    .Include(p => p.Addresses)\r\n    .Where(p => p.Name.StartsWith(name) && IsCustomer(p));\r\n```\r\n\r\nGiven the current behavior, the `p` passed to `IsCustomer` won't be tracked, and the `Addresses` navigation property won't be populated.  \r\n\r\nIf `IsCustomer(p)` returns false, then that person entity won't end in the query results. For a tracked query that means that the instance will be discarded and not tracked. Moreover, for specific providers (e.g. Cosmos DB), even if `IsCustomer(p)` returns true, `p` could be a different object instance from the one that will be included in query results. \r\n\r\nHence the proposal is to make this situation trigger a warning."},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/comments/406681633","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/12667#issuecomment-406681633","issue_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12667","id":406681633,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjY4MTYzMw==","user":{"login":"divega","id":1253414,"node_id":"MDQ6VXNlcjEyNTM0MTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1253414?v=4","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"created_at":"2018-07-20T18:04:11Z","updated_at":"2018-07-20T18:04:11Z","author_association":"MEMBER","body":"Note that the scenario above can become very inefficient because for the second query that we create to include the Addresses collection the evaluation of the client predicate will need to fetch from People again. @smitpatel is going to create an issue that optimizes cases like this (and some others) by filtering the second query in terms of the collection of key values obtained from the first query."}}
{"actor":{"display_login":"divega"}}