{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2451","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2451/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2451/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2451/events","html_url":"https://github.com/aspnet/EntityFramework/issues/2451","id":90456052,"number":2451,"title":"EF attempt to put wrong type of Navigation Property on Entity","user":{"login":"matthewDDennis","id":8105715,"avatar_url":"https://avatars.githubusercontent.com/u/8105715?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewDDennis","html_url":"https://github.com/matthewDDennis","followers_url":"https://api.github.com/users/matthewDDennis/followers","following_url":"https://api.github.com/users/matthewDDennis/following{/other_user}","gists_url":"https://api.github.com/users/matthewDDennis/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewDDennis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewDDennis/subscriptions","organizations_url":"https://api.github.com/users/matthewDDennis/orgs","repos_url":"https://api.github.com/users/matthewDDennis/repos","events_url":"https://api.github.com/users/matthewDDennis/events{/privacy}","received_events_url":"https://api.github.com/users/matthewDDennis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/pri0","name":"pri0","color":"e11d21"}],"state":"closed","locked":false,"assignee":{"login":"AndriySvyryd","id":6539701,"avatar_url":"https://avatars.githubusercontent.com/u/6539701?v=3","gravatar_id":"","url":"https://api.github.com/users/AndriySvyryd","html_url":"https://github.com/AndriySvyryd","followers_url":"https://api.github.com/users/AndriySvyryd/followers","following_url":"https://api.github.com/users/AndriySvyryd/following{/other_user}","gists_url":"https://api.github.com/users/AndriySvyryd/gists{/gist_id}","starred_url":"https://api.github.com/users/AndriySvyryd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndriySvyryd/subscriptions","organizations_url":"https://api.github.com/users/AndriySvyryd/orgs","repos_url":"https://api.github.com/users/AndriySvyryd/repos","events_url":"https://api.github.com/users/AndriySvyryd/events{/privacy}","received_events_url":"https://api.github.com/users/AndriySvyryd/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/7","html_url":"https://github.com/aspnet/EntityFramework/milestones/7.0.0","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/7/labels","id":666128,"number":7,"title":"7.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":212,"closed_issues":207,"state":"open","created_at":"2014-05-21T19:25:32Z","updated_at":"2015-06-29T22:29:38Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2015-06-23T18:22:30Z","updated_at":"2015-06-29T22:47:42Z","closed_at":"2015-06-26T22:14:24Z","body":"Today I started getting the error below. This code worked yesterday.\r\n\r\nIt looks like it wants to create a `Article.Authors` as `ArticleMember` instead of` IList<ArticleMember>`\r\n\r\n*Error\r\n```\r\nerror   : [Microsoft.AspNet.Diagnostics.ErrorHandlerMiddleware] An unhandled exception has occurred: The navigation property 'Authors' cannot be added to entity type 'CodeProject.Modules.Articles.EF.Article' because its CLR type 'Sys\r\ntem.Collections.Generic.IList`1[[CodeProject.Modules.Articles.EF.ArticleMember, CodeProject.Modules.Articles.EF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' does not match the expected CLR type 'CodeProject.Modules.Artic\r\nles.EF.ArticleMember'.\r\nSystem.InvalidOperationException: The navigation property 'Authors' cannot be added to entity type 'CodeProject.Modules.Articles.EF.Article' because its CLR type 'System.Collections.Generic.IList`1[[CodeProject.Modules.Articles.EF.Ar\r\nticleMember, CodeProject.Modules.Articles.EF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' does not match the expected CLR type 'CodeProject.Modules.Articles.EF.ArticleMember'.\r\n   at Microsoft.Data.Entity.Metadata.EntityType.AddNavigation(String name, ForeignKey foreignKey, Boolean pointsToPrincipal)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.Navigation(String navigationName, ForeignKey foreignKey, Boolean pointsToPrincipal, ConfigurationSource configurationSource, Boolean canOverrideSameSource)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.Navigation(String navigationName, ForeignKey foreignKey, Boolean pointsToPrincipal, ConfigurationSource configurationSource)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.Relationship(InternalEntityTypeBuilder principalEntityTypeBuilder, InternalEntityTypeBuilder dependentEntityTypeBuilder, String navigationToPrincipalName, String\r\n navigationToDependentName, IReadOnlyList`1 foreignKeyProperties, IReadOnlyList`1 principalProperties, ConfigurationSource configurationSource, Nullable`1 isUnique, Nullable`1 isRequired, Func`2 onRelationshipAdding)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalRelationshipBuilder.ReplaceForeignKey(EntityType principalType, EntityType dependentType, String navigationToPrincipalName, String navigationToDependentName, IReadOnlyList`1 forei\r\ngnKeyProperties, IReadOnlyList`1 principalProperties, Nullable`1 isUnique, Nullable`1 isRequired, ConfigurationSource configurationSource)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalRelationshipBuilder.ReplaceForeignKey(ConfigurationSource configurationSource, IReadOnlyList`1 dependentProperties, IReadOnlyList`1 principalProperties, Nullable`1 isUnique, Nulla\r\nble`1 isRequired)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalRelationshipBuilder.NavigationToDependent(String navigationToDependentName, ConfigurationSource configurationSource, Nullable`1 strictPreferExisting)\r\n   at Microsoft.Data.Entity.Metadata.Builders.ReferenceNavigationBuilder.InverseCollectionBuilder(String collection)\r\n   at Microsoft.Data.Entity.Metadata.Builders.ReferenceNavigationBuilder`2.InverseCollection(Expression`1 collection)\r\n   at CodeProject.Modules.Articles.EF.ArticleDbContext.<>c.<OnModelCreating>b__21_2(EntityTypeBuilder`1 b)\r\n   at Microsoft.Data.Entity.ModelBuilder.Entity[TEntity](Action`1 buildAction)\r\n   at CodeProject.Modules.Articles.EF.ArticleDbContext.OnModelCreating(ModelBuilder modelBuilder)\r\n   at Microsoft.Data.Entity.Internal.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)\r\n   at Microsoft.Data.Entity.Internal.ThreadSafeDictionaryCache`2.GetOrAdd(TKey key, Func`2 factory)\r\n   at Microsoft.Data.Entity.Internal.DbContextServices.CreateModel()\r\n   at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()\r\n   at Microsoft.Framework.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)\r\n   at Microsoft.Framework.DependencyInjection.ServiceLookup.Service.ConstructorCallSite.Invoke(ServiceProvider provider)\r\n   at Microsoft.Framework.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)\r\n   at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)\r\n   at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)\r\n   at lambda_method(Closure , ServiceProvider )\r\n   at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)\r\n   at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)\r\n```\r\n\r\n*Related snippets:\r\n```c#\r\n            modelBuilder.Entity<ArticleMember>(b =>\r\n            {\r\n                b.Table(\"Article_Member\");\r\n                b.Key(am => new { am.ArticleId, am.MemberId });\r\n                b.Property(am => am.ArticleId).Column(\"ArticleId\");\r\n                b.Property(am => am.MemberId).Column(\"MemberId\");\r\n\r\n                // Looks like there is a problem here!!!\r\n                b.Reference(am => am.Article).InverseCollection(a => a.Authors)\r\n                                              .ForeignKey(am => am.ArticleId)\r\n                                              .PrincipalKey(a => a.Id);\r\n\r\n                b.Reference(am => am.Member).InverseCollection(m => m.Articles)\r\n                                            .ForeignKey(am => am.MemberId)\r\n                                            .PrincipalKey(m => m.Id);\r\n            });\r\n```\r\n\r\n```c#\r\n    public class ArticleMember\r\n    {\r\n        public int ArticleId { get; set; }\r\n        public virtual Article Article { get; set; }\r\n        public int MemberId { get; set; }\r\n        public virtual Member Member { get; set; }\r\n        public bool Verified { get; set; }\r\n    }\r\n```\r\n\r\n```c#\r\n    public class Article\r\n    {\r\n        public int Id { get; set; }\r\n        public byte ArticleTypeId { get; set; }\r\n       // Some Properties removed for brevity\r\n        public virtual IList<ArticleMember> Authors { get; }  = new List<ArticleMember>();\r\n        public virtual IList<ArticleTagLink> ArticleTagLinks { get; } = new List<ArticleTagLink>();\r\n    }\r\n..."},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/116873085","html_url":"https://github.com/aspnet/EntityFramework/issues/2451#issuecomment-116873085","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2451","id":116873085,"user":{"login":"matthewDDennis","id":8105715,"avatar_url":"https://avatars.githubusercontent.com/u/8105715?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewDDennis","html_url":"https://github.com/matthewDDennis","followers_url":"https://api.github.com/users/matthewDDennis/followers","following_url":"https://api.github.com/users/matthewDDennis/following{/other_user}","gists_url":"https://api.github.com/users/matthewDDennis/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewDDennis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewDDennis/subscriptions","organizations_url":"https://api.github.com/users/matthewDDennis/orgs","repos_url":"https://api.github.com/users/matthewDDennis/repos","events_url":"https://api.github.com/users/matthewDDennis/events{/privacy}","received_events_url":"https://api.github.com/users/matthewDDennis/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T22:47:42Z","updated_at":"2015-06-29T22:47:42Z","body":"Ok, I just confirmed that I am still getting the error on clr-x64 and coreclr-x64 but not on clr-x86 or coreclr-x86.\r\n"}}