Cannot use Singleton Lifetype option with middleware
Kukks opened this issue · 3 comments
Kukks commented
When attempting to use the singleton lifetime option alongside default middleware such as routing and redux, the DI critically fails as they have scoped dependencies.
serviceCollection.AddFluxor(options =>
{
options.WithLifetime(StoreLifetime.Singleton);
options.UseRouting();
options.UseReduxDevTools();
...
});
System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware'.) (Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.) (Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.) (Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.) (Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware'.) (Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.) (Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.Middlewares.Routing.Feature Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.Middlewares.Routing.Feature': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.Feature'.) (Error while validating the service descriptor 'ServiceType: BTCPayApp.UI.Features.RootState+PairConfigLoadedActionEffect Lifetime: Singleton ImplementationType: BTCPayApp.UI.Features.RootState+PairConfigLoadedActionEffect': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'BTCPayApp.UI.Features.RootState+PairConfigLoadedActionEffect'.) (Error while validating the service descriptor 'ServiceType: BTCPayApp.UI.Features.RootState+WalletConfigLoadedActionEffect Lifetime: Singleton ImplementationType: BTCPayApp.UI.Features.RootState+WalletConfigLoadedActionEffect': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'BTCPayApp.UI.Features.RootState+WalletConfigLoadedActionEffect'.) (Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.Middlewares.Routing.Effects Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.Middlewares.Routing.Effects': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.Effects'.)
---> System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
at Microsoft.Extensions.Hosting.HostApplicationBuilder.Build()
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
at Program.<Main>$(String[] args) in C:\Git\BTCPayApp\BTCPayApp.Server\Program.cs:line 17
---> (Inner Exception #1) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
---> (Inner Exception #2) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
---> (Inner Exception #3) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
---> (Inner Exception #4) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.RoutingMiddleware'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
---> (Inner Exception #5) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
---> (Inner Exception #6) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.Middlewares.Routing.Feature Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.Middlewares.Routing.Feature': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.Feature'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.Feature'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
---> (Inner Exception #7) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: BTCPayApp.UI.Features.RootState+PairConfigLoadedActionEffect Lifetime: Singleton ImplementationType: BTCPayApp.UI.Features.RootState+PairConfigLoadedActionEffect': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'BTCPayApp.UI.Features.RootState+PairConfigLoadedActionEffect'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'BTCPayApp.UI.Features.RootState+PairConfigLoadedActionEffect'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
---> (Inner Exception #8) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: BTCPayApp.UI.Features.RootState+WalletConfigLoadedActionEffect Lifetime: Singleton ImplementationType: BTCPayApp.UI.Features.RootState+WalletConfigLoadedActionEffect': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'BTCPayApp.UI.Features.RootState+WalletConfigLoadedActionEffect'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'BTCPayApp.UI.Features.RootState+WalletConfigLoadedActionEffect'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
---> (Inner Exception #9) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Fluxor.Blazor.Web.Middlewares.Routing.Effects Lifetime: Singleton ImplementationType: Fluxor.Blazor.Web.Middlewares.Routing.Effects': Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.Effects'.
---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from singleton 'Fluxor.Blazor.Web.Middlewares.Routing.Effects'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateCallSite(ServiceCallSite callSite)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<---
neozhu commented
I was also thinking of asking a similar question. If I want all clients globally to be able to subscribe to state changes in real-time, due to the current default DI (Dependency Injection) lifetime being Scoped, only within the same page can one subscribe to the state. Even between two pages, subscription cannot be achieved, which is clearly not reasonable
refer to #295
neozhu commented
It seems that the project at https://github.com/servicetitan/Stl.Fusion might solve the global state change subscription issue. You might want to look into it