{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3180","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3180/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3180/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3180/events","html_url":"https://github.com/aspnet/EntityFramework/issues/3180","id":107579224,"number":3180,"title":"A column has been specified more than once in the order by list. Columns in the order by list must be unique.","user":{"login":"Venomed","id":808099,"avatar_url":"https://avatars.githubusercontent.com/u/808099?v=3","gravatar_id":"","url":"https://api.github.com/users/Venomed","html_url":"https://github.com/Venomed","followers_url":"https://api.github.com/users/Venomed/followers","following_url":"https://api.github.com/users/Venomed/following{/other_user}","gists_url":"https://api.github.com/users/Venomed/gists{/gist_id}","starred_url":"https://api.github.com/users/Venomed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Venomed/subscriptions","organizations_url":"https://api.github.com/users/Venomed/orgs","repos_url":"https://api.github.com/users/Venomed/repos","events_url":"https://api.github.com/users/Venomed/events{/privacy}","received_events_url":"https://api.github.com/users/Venomed/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/pri0","name":"pri0","color":"e11d21"}],"state":"open","locked":false,"assignee":{"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},"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/8","html_url":"https://github.com/aspnet/EntityFramework/milestones/Investigation","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/8/labels","id":666133,"number":8,"title":"Investigation","description":"This release is used to track work items that need to be investigated to determine if they are legitimate issues and whether they should be fixed in the current release.\r\n<!--\r\n@huboard:{\"order\":-2}\r\n-->","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":7,"closed_issues":32,"state":"open","created_at":"2014-05-21T19:27:44Z","updated_at":"2015-10-05T17:30:53Z","due_on":null,"closed_at":null},"comments":15,"created_at":"2015-09-21T19:12:33Z","updated_at":"2015-10-08T22:51:57Z","closed_at":null,"body":"I'm running the following query to test out relation configuration in context and get the above error:\r\n\r\n```csharp\r\ncontext.Snapshots.Where(x => x.CorrelationId == correlationId)\r\n        .Include(x => x.OrganisationSnapshot)\r\n            .ThenInclude(x => x.Organisation)\r\n        .Include(x => x.OrganisationSnapshot)\r\n            .ThenInclude(x => x.OrganisationSnapshotSubscriptions)\r\n                .ThenInclude(x => x.Subscription)\r\n                    .ThenInclude(x => x.Application)\r\n        .Include(x => x.UserSnapshots)\r\n            .ThenInclude(x => x.User)\r\n        .Include(x => x.UserSnapshots)\r\n            .ThenInclude(x => x.UserSnapshotSubscriptions)\r\n                .ThenInclude(x => x.Subscription)\r\n                    .ThenInclude(x => x.Application)\r\n        .Take(10);\r\n```\r\n\r\nif I break it down to:\r\n\r\n```csharp\r\ncontext.Snapshots.Where(x => x.CorrelationId == correlationId)\r\n        .Include(x => x.OrganisationSnapshot)\r\n            .ThenInclude(x => x.Organisation)\r\n        .Include(x => x.OrganisationSnapshot)\r\n            .ThenInclude(x => x.OrganisationSnapshotSubscriptions)\r\n                .ThenInclude(x => x.Subscription)\r\n                    .ThenInclude(x => x.Application)\r\n        .Take(10);\r\n```\r\n\r\nor \r\n\r\n```csharp\r\ncontext.Snapshots.Where(x => x.CorrelationId == correlationId)\r\n        .Include(x => x.OrganisationSnapshot)\r\n            .ThenInclude(x => x.Organisation)\r\n        .Include(x => x.OrganisationSnapshot)\r\n            .ThenInclude(x => x.OrganisationSnapshotSubscriptions)\r\n                .ThenInclude(x => x.Subscription)\r\n                    .ThenInclude(x => x.Application)\r\n        .Take(10);\r\n```\r\nthen it works fine.\r\n\r\nProfiler shows that SQL is indeed messed up:\r\n\r\n```sql\r\nexec sp_executesql N'SELECT TOP(10) [x].[Id], [other column names snipped for brevity]\r\nFROM [Snapshots] AS [x]\r\nLEFT JOIN [OrganisationSnapshots] AS [o] ON [o].[Id] = [x].[Id]\r\nLEFT JOIN [Organisations] AS [o0] ON [o].[OrganisationId] = [o0].[Id]\r\nLEFT JOIN [OrganisationSnapshots] AS [o1] ON [o1].[Id] = [x].[Id]\r\nWHERE [x].[CorrelationId] = @__correlationId_0\r\nORDER BY [o1].[Id], [o1].[Id]',N'@__correlationId_0 uniqueidentifier',@__correlationId_0='xxx'\r\n\r\n         ^^^^^^^^^^^^^^^^^^^^ \r\n```"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/146710105","html_url":"https://github.com/aspnet/EntityFramework/issues/3180#issuecomment-146710105","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3180","id":146710105,"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":"2015-10-08T22:51:57Z","updated_at":"2015-10-08T22:51:57Z","body":"@emrs-jm I filed a new issue with your suggestion about the include: https://github.com/aspnet/EntityFramework/issues/3384"}}