5

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.

plalx
  • 42,889
  • 6
  • 74
  • 90
E-A
  • 1,995
  • 6
  • 33
  • 47

2 Answers2

9

Looks like some of libs (ocelot) are incompatible with new changes in FluentValidation 8.1.2. Try to downgrade to FluentValidation before 8.1.2. Hope it helps

Alexey.Petriashev
  • 1,634
  • 1
  • 15
  • 19
  • Thankyou!!! Your diagnose is 100% correct. However, none of the FluentValidation v8.*.* version did work with both Ocelot version 12 and 13. The only version of FluentValidation I managed to work is 7.6.105 (possibly earlier versions will work too but I used the latest I could make it work) – E-A Feb 11 '19 at 10:28
  • 3
    I was getting the same error for 10.1.0 and downgrading to 9.5.4 worked. – Kishan Vaishnav May 07 '21 at 06:06
0

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.

Maarten Kieft
  • 6,806
  • 3
  • 29
  • 34