Skip to content

[BUG] - FluentValidation validators are not settable in ValidationCommandBehavior. #164

@devilishgoat

Description

@devilishgoat

Describe the bug

We have a bunch of FluentValidation validators that are not being picked up.

Steps to Reproduce

We run the following code when we initialise..

public static class CortexMediatorConfiguration
{
    public static IServiceCollection ConfigureCortexMediator(this IServiceCollection services, IConfiguration configuration)
    {

        services.AddCortexMediator(
            configuration,
            handlerAssemblyMarkerTypes: [typeof(Program)],
            options => options.AddDefaultBehaviors().AddOpenCommandPipelineBehavior(typeof(ValidationCommandBehavior<,>)));

        return services;
    }
}

Expected Behavior
Validators for the command behaviour are discovered

Actual Behavior
Validators for command behaviour are always null

Environment Information

  • OS: Windows 10
  • .NET Runtime/Version: .NET 10.0
  • Cortex SDK Version: 2.2

Code Samples / Logs

public static class CortexMediatorConfiguration
{
    public static IServiceCollection ConfigureCortexMediator(this IServiceCollection services, IConfiguration configuration)
    {

        services.AddCortexMediator(
            configuration,
            handlerAssemblyMarkerTypes: [typeof(Program)],
            options => options.AddDefaultBehaviors().AddOpenCommandPipelineBehavior(typeof(ValidationCommandBehavior<,>)));

        return services;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfixThis label is in use for patch version increments

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions