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

Fix the issue that the ChildRules will corrupt the RuleSets of a validator passed to the SetValidator #1982

Conversation

sumtec
Copy link
Contributor

@sumtec sumtec commented Aug 1, 2022

Fixes #1981

@dnfadmin
Copy link
Collaborator

dnfadmin commented Aug 1, 2022

CLA assistant check
All CLA requirements met.

Copy link
Member

@JeremySkinner JeremySkinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sumtec thanks for this. It looks like the new test is currently failing - could you take a look at that please? It looks like everything in ruleset b is still being executed, even though only a is selected for inclusion.

  Failed FluentValidation.Tests.ChildRulesTests.ChildRules_works_with_SetValidator_and_RuleSet [3 ms]
  Error Message:
   Assert.Equal() Failure
Expected: 1
Actual:   2
  Stack Trace:
     at FluentValidation.Tests.TestExtensions.ShouldEqual(Object actual, Object expected) in /home/runner/work/FluentValidation/FluentValidation/src/FluentValidation.Tests/TestExtensions.cs:line 27
   at FluentValidation.Tests.ChildRulesTests.ChildRules_works_with_SetValidator_and_RuleSet() in /home/runner/work/FluentValidation/FluentValidation/src/FluentValidation.Tests/ChildRulesTests.cs:line 83

@sumtec
Copy link
Contributor Author

sumtec commented Aug 5, 2022

Hi @sumtec thanks for this. It looks like the new test is currently failing - could you take a look at that please? It looks like everything in ruleset b is still being executed, even though only a is selected for inclusion.

  Failed FluentValidation.Tests.ChildRulesTests.ChildRules_works_with_SetValidator_and_RuleSet [3 ms]
  Error Message:
   Assert.Equal() Failure
Expected: 1
Actual:   2
  Stack Trace:
     at FluentValidation.Tests.TestExtensions.ShouldEqual(Object actual, Object expected) in /home/runner/work/FluentValidation/FluentValidation/src/FluentValidation.Tests/TestExtensions.cs:line 27
   at FluentValidation.Tests.ChildRulesTests.ChildRules_works_with_SetValidator_and_RuleSet() in /home/runner/work/FluentValidation/FluentValidation/src/FluentValidation.Tests/ChildRulesTests.cs:line 83

Sorry that the last check-in seems to have some issues. Neither the test case nor the source code is the correct one.
I've made a new commit to fix the files.

@JeremySkinner
Copy link
Member

Thanks! I'll aim to get a release out over the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChildRules will corrupt the RuleSets of a validator passed to the SetValidator
3 participants