Skip to content

Defining query/query filter throws when using shared type entity type Set overload #24601

Closed

Description

modelBuilder.Entity<AnimalQuery>().ToInMemoryQuery(() => context.Set<Dictionary<string, object>>("BirdSTET").Select(b => MaterializeView(b)));
  Message: 
    System.ArgumentNullException : Value cannot be null. (Parameter 'entityType')
  Stack Trace: 
    Check.NotNull[T](T value, String parameterName) line 27
    QueryRootExpression.ctor(IEntityType entityType) line 45
    DbSetAccessRewritingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) line 114
    MethodCallExpression.Accept(ExpressionVisitor visitor)
    ExpressionVisitor.Visit(Expression node)
    ExpressionVisitor.VisitLambda[T](Expression`1 node)
    Expression`1.Accept(ExpressionVisitor visitor)
    ExpressionVisitor.Visit(Expression node)
    DbSetAccessRewritingExpressionVisitor.Rewrite(IReadOnlyModel model, Expression expression) line 81
    DefiningQueryRewritingConvention.ProcessModelFinalizing(IConventionModelBuilder modelBuilder, IConventionContext`1 context) line 38
    ImmediateConventionScope.OnModelFinalizing(IConventionModelBuilder modelBuilder) line 74
    ConventionDispatcher.OnModelFinalizing(IConventionModelBuilder modelBuilder) line 64
    Model.FinalizeModel() line 858
    ModelBuilder.FinalizeModel() line 547
    ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, ModelDependencies modelDependencies) line 181
    ModelSource.GetModel(DbContext context, ModelCreationDependencies modelCreationDependencies, Boolean designTime) line 130
    DbContextServices.CreateModel(Boolean designTime) line 87
    DbContextServices.get_Model() line 114
    <>c.<TryAddCoreServices>b__7_3(IServiceProvider p) line 256
    CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.ResolveService(ServiceCallSite callSite, RuntimeResolverContext context, RuntimeResolverLock lockType, ServiceProviderEngineScope serviceProviderEngine)
    CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
    CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.ResolveService(ServiceCallSite callSite, RuntimeResolverContext context, RuntimeResolverLock lockType, ServiceProviderEngineScope serviceProviderEngine)
    CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
    CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.ResolveService(ServiceCallSite callSite, RuntimeResolverContext context, RuntimeResolverLock lockType, ServiceProviderEngineScope serviceProviderEngine)
    CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
    CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.ResolveService(ServiceCallSite callSite, RuntimeResolverContext context, RuntimeResolverLock lockType, ServiceProviderEngineScope serviceProviderEngine)
    CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
    CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.ResolveService(ServiceCallSite callSite, RuntimeResolverContext context, RuntimeResolverLock lockType, ServiceProviderEngineScope serviceProviderEngine)
    CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
    CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.ResolveService(ServiceCallSite callSite, RuntimeResolverContext context, RuntimeResolverLock lockType, ServiceProviderEngineScope serviceProviderEngine)
    CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
    CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
    CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
    CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
    <>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
    ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
    ServiceProviderEngineScope.GetService(Type serviceType)
    ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
    ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
    DbContext.get_DbContextDependencies() line 399
    DbContext.get_ContextServices() line 381
    DbContext.get_InternalServiceProvider() line 335
    IServiceProvider>.get_Instance() line 1801
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area-queryclosed-fixedThe issue has been fixed and is/will be included in the release indicated by the issue milestone.type-bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions