jbogard / MediatR

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

#1048 and v12.4.0 breaks RequestExceptionProcessorBehavior #1055

Open luis-fss opened 1 month ago

luis-fss commented 1 month ago

The example code in https://github.com/jbogard/MediatR/wiki#exception-handler-pipeline-step

public class RequestExceptionProcessorBehavior<TRequest, TResponse, TException> : IRequestExceptionHandler<TRequest, TResponse, TException>
    where TRequest : notnull where TException : Exception
{
    public Task Handle(TRequest request, TException exception, RequestExceptionHandlerState<TResponse> state, CancellationToken cancellationToken)
    {
        throw new NotImplementedException();
    }
}

will throw an exception on startup:

System.ArgumentException: Error registering the generic handler type: PMCM.BlazorApp.Core.Pipeline.RequestExceptionProcessorBehavior`3. When registering generic requests with more than two type parameters, each type parameter must have at least one constraint of type interface or class.

luis-fss commented 1 month ago

Related:

1047

1048

1038

zachpainter77 commented 1 month ago

I created a PR to remove the logic that causes that error.

1057