Skip to content

[Error Orleans 7]: Cannot resolve scoped service 'Orleans.Streams.StreamDirectory' from root provider. #8219

Open

Description

Hi
The exception is thrown when we create a singleton service and implement ILifecycleParticipant and then call GetStream from IStreamProvider:

async Task ILifecycleObserver.OnStart(CancellationToken cancellationToken)
{
    Logger.LogInitializing(_logger, _hubName, _serverId);
    _streamProvider = _clusterClient.GetStreamProvider(PusherStream.StreamProvider);
    _serverStream = _streamProvider.GetStream<ClientMessage>(_serverId, PusherStream.ServerStream);
}

The participant state is ServiceLifecycleStage.Active.
The error detail:

2022-12-09 11:02:21    [Error-11:02:21.050 +03:30] Exception during Silo.Start System.InvalidOperationException: Cannot resolve scoped service 'Orleans.Streams.StreamDirectory' from root provider.
2022-12-09 11:02:21    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(Type serviceType, IServiceScope scope, IServiceScope rootScope)
2022-12-09 11:02:21    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
2022-12-09 11:02:21    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
2022-12-09 11:02:21    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
2022-12-09 11:02:21    at Orleans.Runtime.Providers.SiloStreamProviderRuntime.GetStreamDirectory() in /_/src/Orleans.Streaming/Providers/SiloStreamProviderRuntime.cs:line 127
2022-12-09 11:02:21    at Orleans.Providers.Streams.Common.PersistentStreamProvider.GetStream[T](StreamId streamId) in /_/src/Orleans.Streaming/PersistentStreams/PersistentStreamProvider.cs:line 158
2022-12-09 11:02:21    at Orleans.Streams.StreamProviderExtensions.GetStream[T](IStreamProvider streamProvider, String ns, String id) in /_/src/Orleans.Streaming/Providers/IStreamProvider.cs:line 73
2022-12-09 11:02:21    at DoctorCode.Oms.Pusher.Sockets.OrleansHubLifetimeManager`1.Orleans.ILifecycleObserver.OnStart(CancellationToken cancellationToken) in D:\Projects\oms\pusher\DoctorCode.Oms.Pusher\Sockets\OrleansHubLifetimeManager.cs:line 68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions