Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IRequestPreProcessor not executed #763

Closed
MilivojeMishikj opened this issue Jul 13, 2022 · 1 comment
Closed

IRequestPreProcessor not executed #763

MilivojeMishikj opened this issue Jul 13, 2022 · 1 comment

Comments

@MilivojeMishikj
Copy link

I have two preprocessors for one request.
One is declared as
public class PreProcessorA : IRequestPreProcessor<MyCommand>
the other as:
public class PreProcessorB<TRequest> : IRequestPreProcessor<TRequest> where TRequest : IMyInterface

Before the IRequestHandler.Handle is processed then only the PreProcessorA is executed, but not the PreProcessorB.
Another symptom is that the PreProcessorA is executed twice.

I register the with
.AddMediatR(typeof(MyCommand)).

My version of MediatR and MediatR.Extensions.Microsoft.DependencyInjection is the latest, v.10.0.1.

I found a similar issue (jbogard/MediatR.Extensions.Microsoft.DependencyInjection#58) but it seems it was resolved some years ago (jbogard/MediatR.Extensions.Microsoft.DependencyInjection#59).

Thanks in advance.

@MilivojeMishikj
Copy link
Author

Declaring PreProcessorA as below resolves the issue:

public class PreProcessorA<TRequest>
    : IRequestPreProcessor<TRequest>
        where TRequest : MyCommand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant