simplesoft-pt / Mediator

Small .NET library that helps with the implementation of mediator pattern for commands, events and queries
MIT License
41 stars 9 forks source link

ValidationPipeline - Member breaking change #17

Closed gravity00 closed 2 years ago

gravity00 commented 2 years ago

Due to a breaking change in version 10 of FluentValidation, which changed the return type of ValidationResult.Errors from an IList<ValidationFailure> to a List<ValidationFailure>, and the validation pipeline was compiled against the version 9, an MissingMethodException will be thrown:

System.MissingMethodException: Method not found: 'System.Collections.Generic.IList`1<FluentValidation.Results.ValidationFailure> FluentValidation.Results.ValidationResult.get_Errors()'.
   at SimpleSoft.Mediator.ValidationPipeline.ValidateInstanceAsync[T](T instance, CancellationToken ct)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at SimpleSoft.Mediator.ValidationPipeline.ValidateInstanceAsync[T](T instance, CancellationToken ct)
   at SimpleSoft.Mediator.ValidationPipeline.OnCommandAsync[TCommand,TResult](Func`3 next, TCommand cmd, CancellationToken ct)

Without breaking changes in the validation library, the only plausible solution is to reference version 10 and recompile.