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

[BUG] Incorrect behaviors registration with assemblies scanning #1088

Open
quatrebi opened this issue Nov 21, 2024 · 1 comment
Open

[BUG] Incorrect behaviors registration with assemblies scanning #1088

quatrebi opened this issue Nov 21, 2024 · 1 comment
Labels

Comments

@quatrebi
Copy link

quatrebi commented Nov 21, 2024

Built-in RequestPre/PostProcessorBehaviors are not registered in DI after scaning assemblies for IRequestPre/PostProcessor.

Actual

I have MediatR injection with the following config:

        services.AddMediatR(cfg =>
        {
            cfg.RegisterServicesFromAssemblies(assembliesToScan);
            cfg.AutoRegisterRequestProcessors = true;
        });

and my Pre/PostProcessor are rigistered succesfully, but not behaviour for that.

So, I go deep into underhood MediatR and found following:

  • Pre/PostProcessors will be registered if AutoRegisterRequestProcessors == true . source code *link*
  • RequestPre/PostProcessorBehavior will be registerd if we have at least one ServiceDescriptor in MediatR configuration!!: cfg.RequestPreProcessorsToRegister.Any() == true. source code *link*

Expected

Built-in RequestPre/PostProcessorBehaviors also MUST BE registred when any Pre/PostProcessers have already been registered

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant