Friday, August 5, 2022

[FIXED] What is the cause of FluentValidation Method Not Found exception?

Issue

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

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



Answered By - Alexey.Petriashev
Answer Checked By - Robin (PHPFixing Admin)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.