Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException after the "Add IMutableModel API" changes #3555

Closed
Jetski5822 opened this issue Oct 25, 2015 · 3 comments
Closed

NullReferenceException after the "Add IMutableModel API" changes #3555

Jetski5822 opened this issue Oct 25, 2015 · 3 comments

Comments

@Jetski5822
Copy link

Latest cut of the code seems to be throwing a null ref exception in Remove.

Invoking handler threw error.                                                                                                                                                                
System.NullReferenceException: Object reference not set to an instance of an object.                                                                                                         
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Remove(EntityType entityType, ConfigurationSource configurationSource)                                                    
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Ignore(EntityType entityType, String name, ConfigurationSource configurationSource)                                       
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.RemoveEntityTypesUnreachableByNavigations(ConfigurationSource configurationSource)                                        
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ModelCleanupConvention.Apply(InternalModelBuilder modelBuilder)                                                                    
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnModelBuilt(InternalModelBuilder modelBuilder)                                                               
   at Microsoft.Data.Entity.ModelBuilder.Validate()                                                                                                                                          
   at Microsoft.Data.Entity.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)                                 
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)                                                                                           
   at Microsoft.Data.Entity.Internal.DbContextServices.CreateModel()                                                                                                                         
   at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()                                                                                                                                   
   at Microsoft.Data.Entity.Internal.DbContextServices.get_Model()                                                                                                                           
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetService[T](IServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ClosedIEnumerableService.CallSite.Invoke(ServiceProvider provider)                                                              
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)                                                     
   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)                                                                    
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)                                                                            
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)                                                                               
   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)                                                     
   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)                                                                    
   at Microsoft.Data.Entity.Internal.InternalDbSet`1.<.ctor>b__2_0()                                                                                                                         
   at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()                                                                                                                                   
   at Microsoft.Data.Entity.Internal.InternalDbSet`1.System.Linq.IQueryable.get_Provider()                                                                                                   
   at System.Linq.Queryable.Any[TSource](IQueryable`1 source, Expression`1 predicate)                                                                                                        
   at Orchard.Data.EntityFramework.EFContentQueryStore.Query[TDocument](Expression`1 map) in D:\Brochard\src\Orchard.Web\Modules\Orchard.Data.EntityFramework\Indexing\EFContentQueryStore.cs
@rowanmiller
Copy link
Contributor

@Jetski5822 can you provide some code for us to reproduce the issue you are seeing?

@Jetski5822
Copy link
Author

Hey @rowanmiller I will try to see if I can create a small repo for you... though it might be difficult to pull out of the Orchard code base.

What I can say is that it is using a InMemory database... and is storing and reading in the same request. The DataContext is per-request too.

@rowanmiller
Copy link
Contributor

Closing as we have not heard back with a repro. Feel free to reopen if you are able to provide it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants