{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4869","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4869/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4869/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4869/events","html_url":"https://github.com/aspnet/EntityFramework/issues/4869","id":142394965,"number":4869,"title":"Exception in model building algorithm with some special property","user":{"login":"chandrush","id":1695006,"avatar_url":"https://avatars.githubusercontent.com/u/1695006?v=3","gravatar_id":"","url":"https://api.github.com/users/chandrush","html_url":"https://github.com/chandrush","followers_url":"https://api.github.com/users/chandrush/followers","following_url":"https://api.github.com/users/chandrush/following{/other_user}","gists_url":"https://api.github.com/users/chandrush/gists{/gist_id}","starred_url":"https://api.github.com/users/chandrush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chandrush/subscriptions","organizations_url":"https://api.github.com/users/chandrush/orgs","repos_url":"https://api.github.com/users/chandrush/repos","events_url":"https://api.github.com/users/chandrush/events{/privacy}","received_events_url":"https://api.github.com/users/chandrush/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-21T16:04:46Z","updated_at":"2016-03-21T19:41:28Z","closed_at":null,"body":"Hello! \r\n\r\nI've met strange error at adding migration with entity (dryed for example)\r\n\r\n```\r\npublic class IssuerEntity\r\n{\r\n\tpublic string Id { get; set; }\r\n\r\n\tpublic X509Certificate2 Certificate\r\n\t{\r\n\t\tget\r\n\t\t{\r\n\t\t\treturn null;\r\n\t\t\t//return new X509Certificate2(CertificateBytes);\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nand ModelCreating code\r\n\r\n```\r\nprotected override void OnModelCreating(ModelBuilder modelBuilder)\r\n{\r\n\tvar ie = modelBuilder.Entity<IssuerEntity>();\r\n\tie.Ignore(e => e.Certificate);\r\n\r\n\tie.Property(c => c.Id)\r\n\t\t.HasMaxLength(32);\r\n\tie.Property(e => e.Id);\r\n}\r\n```\r\n\r\nIf I comment IssuerEntity.Certificate property - migration is added, as expected\r\n\r\nThe error is\r\n\r\nSystem.NullReferenceException: Object reference not set to an instance of an object.\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.IsIgnored(String name, ConfigurationSource configurationSource)\r\n   at Microsoft.Data.Entity.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.FindRelationshipCandidates(InternalEntityTypeBuilder entityTypeBuilder)\r\n   at Microsoft.Data.Entity.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder)\r\n   at Microsoft.Data.Entity.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.ApplyOnRelatedEntityTypes(InternalModelBuilder modelBuilder, EntityType entityType)\r\n   at Microsoft.Data.Entity.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, EntityType oldBaseType)\r\n   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnBaseEntityTypeSet(InternalEntityTypeBuilder entityTypeBuilder, EntityType previousBaseType)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.HasBaseType(EntityType baseEntityType, ConfigurationSource configurationSource)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Remove(EntityType entityType, ConfigurationSource configurationSource)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Ignore(EntityType entityType, String name, ConfigurationSource configurationSource)\r\n   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.RemoveEntityTypesUnreachableByNavigations(ConfigurationSource configurationSource)\r\n   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ModelCleanupConvention.Apply(InternalModelBuilder modelBuilder)\r\n   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnModelBuilt(InternalModelBuilder modelBuilder)\r\n   at Microsoft.Data.Entity.ModelBuilder.Validate()\r\n   at Microsoft.Data.Entity.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)\r\n   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)\r\n   at Microsoft.Data.Entity.Internal.DbContextServices.CreateModel()\r\n   at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetService[T](IServiceProvider provider)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)\r\n   at Microsoft.Data.Entity.Design.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)\r\n   at Microsoft.Data.Entity.Commands.Program.Executor.<>c__DisplayClass6_0.<AddMigration>b__0()\r\n   at Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action)\r\nObject reference not set to an instance of an object."},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/199443849","html_url":"https://github.com/aspnet/EntityFramework/issues/4869#issuecomment-199443849","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4869","id":199443849,"user":{"login":"chandrush","id":1695006,"avatar_url":"https://avatars.githubusercontent.com/u/1695006?v=3","gravatar_id":"","url":"https://api.github.com/users/chandrush","html_url":"https://github.com/chandrush","followers_url":"https://api.github.com/users/chandrush/followers","following_url":"https://api.github.com/users/chandrush/following{/other_user}","gists_url":"https://api.github.com/users/chandrush/gists{/gist_id}","starred_url":"https://api.github.com/users/chandrush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chandrush/subscriptions","organizations_url":"https://api.github.com/users/chandrush/orgs","repos_url":"https://api.github.com/users/chandrush/repos","events_url":"https://api.github.com/users/chandrush/events{/privacy}","received_events_url":"https://api.github.com/users/chandrush/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T19:41:28Z","updated_at":"2016-03-21T19:41:28Z","body":"The version of EF is 7.0.0-rc1-final."}}