jbogard / MediatR

Simple, unambitious mediator implementation in .NET
Apache License 2.0
11.06k stars 1.17k forks source link

.NET 8 Calling IPublisher.Publish method throws ObjectDisposedException for IServiceProvider #983

Closed DaniilPoiarkov closed 10 months ago

DaniilPoiarkov commented 10 months ago

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'IServiceProvider'. at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException() at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at MediatR.Wrappers.NotificationHandlerWrapperImpl1.Handle(INotification notification, IServiceProvider serviceFactory, Func4 publish, CancellationToken cancellationToken) at MediatR.Mediator.PublishNotification(INotification notification, CancellationToken cancellationToken) at MediatR.Mediator.Publish[TNotification](TNotification notification, CancellationToken cancellationToken)

jbogard commented 10 months ago

This is better suited for Stack Overflow.