question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgraded to FluentValidation 10.x and .NET 6 Preview 3, getting the following error

See original GitHub issue
Error: System.MissingMethodException: Method not found: 'System.Collections.Generic.IList`1<FluentValidation.Results.ValidationFailure> FluentValidation.Results.ValidationResult.get_Errors()'.
   at Microsoft.AspNetCore.Components.Forms.FluentValidator.ValidateModel(EditContext editContext, ValidationMessageStore messages)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Components.Forms.FluentValidator.ValidateModel(EditContext editContext, ValidationMessageStore messages)
   at Microsoft.AspNetCore.Components.Forms.FluentValidator.<>c__DisplayClass24_0.<AddValidation>b__0(Object sender, ValidationRequestedEventArgs eventArgs)
   at Microsoft.AspNetCore.Components.Forms.EditContext.Validate()
   at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:10
  • Comments:5

github_iconTop GitHub Comments

10reactions
JeremySkinnercommented, Apr 22, 2021

Hi @ryanelian, I just wanted to weigh in and provide some context on the above. This happens because FV’s ValidationResult.Errors property was changed from an IList<ValidationFailure> to List<ValidationFailure> with the 10.0 release. The Accelist.FluentValidation.Blazor package doesn’t currently contain an upper version limit for its FluentValidation dependency, so nuget will allow users to upgrade from FV 9 to 10 without warning them there’s a compatibility issue.

The fix in this case is just to recompile against FV 10, but I’d also suggest patching the current release to add an upper version limit too.

I’d suggest the following:

  • Create a 4.0.1 patch release that provides an upper version constraint limiting the FluentValidation dependency to versions >= 9.5.4 && < 10.0 with <PackageReference Include="FluentValidation" Version="[9.5.4,10.0)" />
  • Additionally create a 5.0.0 major release that updates to FluentValidation 10 and includes a constraint of >= 10.0.4 && < 11.0 with with <PackageReference Include="FluentValidation" Version="[10.0.4,11.0)" />

Please feel free to ping me if you have questions about upgrading to 10.0

1reaction
carlblanchardcommented, May 27, 2021

@pablopioli You are a legend!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

10.0 Upgrade Guide — FluentValidation documentation
FluentValidation 10.0 is a major release that included several breaking changes. Please review this document carefully before upgrading from FluentValidation 9.
Read more >
Error with NinjectValidatorFactory after updating ...
It looks as if the problem is that FluentValidation used to be a signed assembly but is now an unsigned assembly. Ninject.Web.
Read more >
11.0 Upgrade Guide — FluentValidation documentation
FluentValidation 11.0 is a major release that included several breaking changes. Please review this document carefully before upgrading from FluentValidation 10 ...
Read more >
Fluent Validation in ASP.NET Core – Complete Guide
You get Fluent Validation! With Fluent Validation, you can create complex validation rules using a process called “method chaining” or “fluent ...
Read more >
FluentValidation — FluentValidation documentation
FluentValidation is a .NET library for building strongly-typed validation rules. FluentValidation 11 supports the following platforms: .NET Core 3.1 .NET 5 .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found