You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrapping a call to RuleForEach with WhenAsync will trigger a AsyncValidatorInvokedSynchronouslyException even when calling ValidateAsync.
The AsyncValidatorInvokedSynchronouslyException should only be thrown when calling Validate, never ValidateAsync.
Steps to Reproduce
classMyValidator:AbstractValidator<Person>{publicMyValidator(){WhenAsync((x,cancel)=>x.Id>0,()=>{RuleForEach(x =>x.Nicknames).NotNull();});}}classPerson{publicintId{get;set;}publicstring[]Nicknames{get;set;}}varvalidator=newMyValidator();awaitvalidator.ValidateAsync(newPerson());// Incorrectly throws a AsyncValidatorInvokedSynchronouslyException even though it was invoked asynchronously.