{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6485","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6485/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6485/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6485/events","html_url":"https://github.com/aspnet/EntityFramework/issues/6485","id":175536616,"number":6485,"title":"InvalidOperationException: The instance of entity type 'Entity1' cannot be tracked because another instance of this type with the same key is already being tracked.","user":{"login":"dpjain","id":10938899,"avatar_url":"https://avatars.githubusercontent.com/u/10938899?v=3","gravatar_id":"","url":"https://api.github.com/users/dpjain","html_url":"https://github.com/dpjain","followers_url":"https://api.github.com/users/dpjain/followers","following_url":"https://api.github.com/users/dpjain/following{/other_user}","gists_url":"https://api.github.com/users/dpjain/gists{/gist_id}","starred_url":"https://api.github.com/users/dpjain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpjain/subscriptions","organizations_url":"https://api.github.com/users/dpjain/orgs","repos_url":"https://api.github.com/users/dpjain/repos","events_url":"https://api.github.com/users/dpjain/events{/privacy}","received_events_url":"https://api.github.com/users/dpjain/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/closed-could-not-reproduce","name":"closed-could-not-reproduce","color":"777777"}],"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":null,"comments":9,"created_at":"2016-09-07T15:40:37Z","updated_at":"2016-10-27T00:26:24Z","closed_at":"2016-09-20T23:17:42Z","body":"```\r\n  [HttpPost]\r\n        public IActionResult Action1(Entity1 entity1)\r\n        {\r\n            Entity1 objEntity1 = _context.Entity1.AsNoTracking().Single(s => s.Id == entity1.Id);\r\n            if (ModelState.IsValid)\r\n            {\r\n               entity1.Property1 = objEntity1.Property1;\r\n                _context.Update(entity1);\r\n                _context.SaveChanges();\r\n             }\r\nreturn View();\r\n        }\r\n```\r\n\r\n### The issue\r\nGot the following issue while updating the context for Entity1. (It was working properly with asp.net core RC1, but failed for .net core 1.0.)\r\n\r\nInvalidOperationException: The instance of entity type 'BookingVenueSite' cannot be tracked because another instance of this type with the same key is already being tracked. When adding new entities, for most key types a unique temporary key value will be created if no key is set (i.e. if the key property is assigned the default value for its type). If you are explicitly setting key values for new entities, ensure they do not collide with existing entities or temporary values generated for other new entities. When attaching existing entities, ensure that only one entity instance with a given key value is attached to the context.\r\n\r\n### Further technical details\r\n\r\nEF Core version: EntityFrameworkCore\r\nVisual Studio version: VS 2015"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/256514498","html_url":"https://github.com/aspnet/EntityFramework/issues/6485#issuecomment-256514498","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6485","id":256514498,"user":{"login":"iberodev","id":5520769,"avatar_url":"https://avatars.githubusercontent.com/u/5520769?v=3","gravatar_id":"","url":"https://api.github.com/users/iberodev","html_url":"https://github.com/iberodev","followers_url":"https://api.github.com/users/iberodev/followers","following_url":"https://api.github.com/users/iberodev/following{/other_user}","gists_url":"https://api.github.com/users/iberodev/gists{/gist_id}","starred_url":"https://api.github.com/users/iberodev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iberodev/subscriptions","organizations_url":"https://api.github.com/users/iberodev/orgs","repos_url":"https://api.github.com/users/iberodev/repos","events_url":"https://api.github.com/users/iberodev/events{/privacy}","received_events_url":"https://api.github.com/users/iberodev/received_events","type":"User","site_admin":false},"created_at":"2016-10-27T00:26:24Z","updated_at":"2016-10-27T00:26:24Z","body":"I have had a similar error. View this ticket where there is a link to a sample project all ready to reproduce the issue.\r\nhttps://github.com/aspnet/EntityFramework/issues/6873"}}
{"actor":{"display_login":"iberodev"}}