Skip to content

.net7.0: GetValidator for type 'System.ReadOnlySpan`1[System.Byte]' fails. #124

@ChrisRichner

Description

@ChrisRichner

Hi there

I'm facing the following System.ArgumentException when updating my service from .net 6.0 to .net 7.0. This exception is thrown when the /swagger site is first accessed.

  • FluentValidation.AspNetCore 11.2.2
  • Swashbuckle.AspNetCore.Swagger 6.5.0
warn: MicroElements.Swashbuckle.FluentValidation.FluentValidationRules[0]
      GetValidator for type 'System.ReadOnlySpan`1[System.Byte]' fails.
      System.ArgumentException: GenericArguments[0], 'System.ReadOnlySpan`1[System.Byte]', on 'FluentValidation.IValidator`1[T]' violates the constraint of type 'T'.
       ---> System.TypeLoadException: GenericArguments[0], 'System.ReadOnlySpan`1[System.Byte]', on 'FluentValidation.IValidator`1[T]' violates the constraint of type parameter 'T'.
         at System.RuntimeTypeHandle.Instantiate(RuntimeType inst)
         at System.RuntimeType.MakeGenericType(Type[] instantiation)
         --- End of inner exception stack trace ---
         at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
         at System.RuntimeType.MakeGenericType(Type[] instantiation)
         at FluentValidation.ValidatorFactoryBase.GetValidator(Type type) in /_/src/FluentValidation/ValidatorFactoryBase.cs:line 42
         at MicroElements.Swashbuckle.FluentValidation.FluentValidationRules.Apply(OpenApiSchema schema, SchemaFilterContext context) in /home/runner/work/MicroElements.Swashbuckle.FluentValidation/MicroElements.Swashbuckle.FluentValidation/src/MicroElements.Swashbuckle.FluentValidation/Swashbuckle/FluentValidationRules.cs:line 92

Please let me know if you need further Infos, thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions