Troubleshooting — EricksonLopez.Mediator
Common compiler and DI diagnostics when working with EricksonLopez.Mediator (2.0.0).
- Cause 1: Missing
EricksonLopez.Mediator.Generatorpackage in the assembly callingAddEricksonLopezMediator(). - Cause 2: Missing
using Microsoft.Extensions.DependencyInjection;(ImplicitUsings=disable), becauseDependencyInjectionGeneratoremits the extension method intoMicrosoft.Extensions.DependencyInjection.
Handler Signature, next.InvokeAsync(), and IStreamRequest<T>
Section titled “Handler Signature, next.InvokeAsync(), and IStreamRequest<T>”- Handlers must return
ValueTask<TResponse>(orValueTaskforINotificationHandler), notTask<TResponse>. - Inside
IPipelineBehavior<,>, invokeawait next.InvokeAsync(), notnext(). - Streaming requests implement
IStreamRequest<TResponse>, notIStreamQuery<TResponse>.
CS0618 on EricksonLopez.Mediator.Polly & Mutable Commands
Section titled “CS0618 on EricksonLopez.Mediator.Polly & Mutable Commands”EricksonLopez.Mediator.Pollyis[Obsolete]inv2.0.0(TreatWarningsAsErrors=truefails the build). Replace it withEricksonLopez.Resilience.Mediator.- Use immutable
sealed recordpositional constructors or{ get; init; }on CQRS commands/queries (local v3+ analyzerELM013flags mutable{ get; set; }).