{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7388","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7388/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7388/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7388/events","html_url":"https://github.com/aspnet/EntityFramework/issues/7388","id":200070899,"number":7388,"title":"Throw for explicit loading of an untracked entity","user":{"login":"ljvanschie","id":1822364,"avatar_url":"https://avatars.githubusercontent.com/u/1822364?v=3","gravatar_id":"","url":"https://api.github.com/users/ljvanschie","html_url":"https://github.com/ljvanschie","followers_url":"https://api.github.com/users/ljvanschie/followers","following_url":"https://api.github.com/users/ljvanschie/following{/other_user}","gists_url":"https://api.github.com/users/ljvanschie/gists{/gist_id}","starred_url":"https://api.github.com/users/ljvanschie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljvanschie/subscriptions","organizations_url":"https://api.github.com/users/ljvanschie/orgs","repos_url":"https://api.github.com/users/ljvanschie/repos","events_url":"https://api.github.com/users/ljvanschie/events{/privacy}","received_events_url":"https://api.github.com/users/ljvanschie/received_events","type":"User","site_admin":false},"labels":[{"id":76481852,"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/type-bug","name":"type-bug","color":"f7c6c7","default":false}],"state":"closed","locked":false,"assignee":{"login":"ajcvickers","id":1430078,"avatar_url":"https://avatars.githubusercontent.com/u/1430078?v=3","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false},"assignees":[{"login":"ajcvickers","id":1430078,"avatar_url":"https://avatars.githubusercontent.com/u/1430078?v=3","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/24","html_url":"https://github.com/aspnet/EntityFramework/milestone/24","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/24/labels","id":2044943,"number":24,"title":"2.0.0","description":"","creator":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"open_issues":185,"closed_issues":73,"state":"open","created_at":"2016-10-03T18:11:14Z","updated_at":"2017-01-13T22:23:36Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2017-01-11T11:38:31Z","updated_at":"2017-01-13T22:23:36Z","closed_at":"2017-01-13T22:23:36Z","body":"When trying to explicitly load a reference or a collection, the values of these properties will still be null in case you are querying a DbSet with NoTracking behaviour (either by using the .AsNoTracking() extension method or by setting the default query tracking behaviour of the DbContext).\r\n\r\nThis had me puzzled quite a while, since this is not mentioned in any documentation. Furthermore, I would expect it to also be working when querying data in a read-only way.\r\n\r\n### Steps to reproduce\r\nQuery a DbSet using .AsNoTracking(), explicitly load a reference, and inspect the property.\r\n\r\n```c#\r\nvar item = _context.Items.AsNoTracking().FirstOrDefault(i => i.ItemId == id);\r\n_context.Entry(item).Reference(a => a.ItemGroup).Load();\r\n\r\n// item.ItemGroup will still be null\r\n```\r\n\r\n### Further technical details\r\nEF Core version: 1.1.0\r\nDatabase Provider: Microsoft.EntityFrameworkCore.SqlServer\r\nIDE: Visual Studio 2015"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/272564453","html_url":"https://github.com/aspnet/EntityFramework/issues/7388#issuecomment-272564453","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/7388","id":272564453,"user":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"created_at":"2017-01-13T22:23:36Z","updated_at":"2017-01-13T22:23:36Z","body":"Decided that we should throw for the moment, this isn't a scenario we intended to support. We may look at explicit loading for untracked entities in the future, based on customer demand. For the moment, using a tracking query, or eager loading, would be our recommendation. "}}
{"actor":{"display_login":"rowanmiller"}}