Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Host.FluentValidation] Duplicated error messages #192

Closed
Eniak opened this issue Aug 28, 2023 · 0 comments · Fixed by #193
Closed

[Host.FluentValidation] Duplicated error messages #192

Eniak opened this issue Aug 28, 2023 · 0 comments · Fixed by #193
Assignees
Labels

Comments

@Eniak
Copy link

Eniak commented Aug 28, 2023

I found an issue with AbstractValdiationInterceptor

var validationTasks = _validators
	.Select(x => x.ValidateAsync(context, cancellationToken));

await Task.WhenAll(validationTasks);

var failures = validationTasks
	.SelectMany(x => x.Result.Errors);

if (failures.Any())

I think lack to ToList() or ToArray() causes this collection to be enumerated more than once in scope of this method. Adding these or changing it to

var results = await Task.WhenAll(validationTasks);

var failures = results
    .SelectMany(x => x.Errors);

may fix the problem.

zarusz added a commit that referenced this issue Aug 28, 2023
Signed-off-by: Tomasz Maruszak <maruszaktomasz@gmail.com>
@zarusz zarusz self-assigned this Aug 28, 2023
@zarusz zarusz added the bug label Aug 28, 2023
zarusz added a commit that referenced this issue Aug 28, 2023
Signed-off-by: Tomasz Maruszak <maruszaktomasz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants