'What is the cause of FluentValidation Method Not Found exception?

I've got a Domain Driven Design solution and for some reason, I'm getting this exception at RunTime when the API call is made through GateWay:

One or more errors occurred. (Method not found: 'Void FluentValidation.AbstractValidator`1.When(System.Func`2<!0,Boolean>, System.Action)'.)

The error occurs as below:

I have solution like this:

The main 4 project I'm focusing on right now are:

  1. Core.Model
  2. Account.Api
  3. Service.Api.Gateway
  4. Web.ClientSite

Web.ClientSite makes request to Service.Api.Gateway which then calls Account.Api. Note that Core.Model is referenced everywhere

VERY IMPORTANT: If I remove the reference of FluentValidation from Core.Model, the exception disappears.

I'm hoping these information is enough. Why do you think I'm getting this exception and how can I eliminate.



Solution 1:[1]

I got similar exception:

System.MissingMethodException : Method not found: 'FluentValidation.AssemblyScanner FluentValidation.AssemblyScanner.FindValidatorsInAssembly(System.Reflection.Assembly)'

In my case I needed to upgrade the ediatR.Extensions.Microsoft.DependencyInjection and MediatR.Extensions.FluentValidation.AspNetCore packages as well to fix the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Maarten Kieft