What's Changed
Breaking changes
IMediatornow inheritsIAsyncDisposable— any code implementingIMediatordirectly must addDisposeAsync(). Consumers ofIMediatorare unaffected.
Bug fixes
MediatorBuilder.RegisterHandlers(Assembly)now correctly picks upIStreamCommandHandler<,>implementors (previously silently skipped, causingNoHandlerFoundExceptionat runtime)- Fixed broken return value in
RequestPipe.ConnectToHandlerIAsyncEnumerablebranch (Task.FromResult(r)→r) PipeHelper.GetResultFromTasknow throwsInvalidOperationExceptionwith a descriptive message instead of bareException
Improvements
MediatorimplementsIAsyncDisposablewith async-path fallback viaDisposeAsync()- Removed unnecessary reflection in
ReceiveContext.PublishAsync—publishPipe.Connect()is now called directly through the interface [EnumeratorCancellation]added toConnectStreamasync-iterator methods so cancellation tokens are correctly forwarded to consumersCount()LINQ extension replaced with.Countproperty (O(1)) at 4 sites inCommandReceivePipeandRequestPipeReceiveContext.MetaDatauses??=operator- Internal class
GlobalRececivePipeConfiguratorrenamed toGlobalReceivePipeConfigurator(typo fix)
Full Changelog: 4.9.0...5.0.0