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

When using class-level-validation via INotifyDataErrorInfo every entry is shown twice #4201

Open
timunie opened this issue Feb 22, 2021 · 0 comments
Labels
Investigate Requires further investigation by the WPF team.
Milestone

Comments

@timunie
Copy link

timunie commented Feb 22, 2021

  • .NET Core Version: 5.0.103
  • Windows version: 10.0.19042
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No
  • Security issues and bugs should be reported privately, learn more via our responsible disclosure guidelines.

Problem description:
If you bind to a class which implements INotifyDataErrorInfo it runs validation for the whole class. It should show the issue for each property once, but shows it twice.

Actual behavior:
Every issue is shown twice like shown in the following image:
image

Investigating this further showed that the method GetErrors(string propertyName) gets calles twice. One time for null and one time for string.Empty. According to the docs both calls will return the same result: https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifydataerrorinfo.geterrors?view=net-5.0

"The name of the property to retrieve validation errors for; or null or Empty, to retrieve entity-level errors."

I also discussed this here as I first thought it was a bug there: CommunityToolkit/WindowsCommunityToolkit#3763

Expected behavior:
Every issue is shown only once.

Minimal repro:
https:/timunie/MvvmToolkitValidationSample

Thank you and happy coding
Tim

@timunie timunie changed the title When using class-level-validation via INotifyDataErrorInfo When using class-level-validation via INotifyDataErrorInfo every entry is shown twice Feb 22, 2021
@ryalanms ryalanms added Investigate Requires further investigation by the WPF team. and removed Requires WPF team triage Untriaged labels Feb 25, 2021
@ryalanms ryalanms added this to the Future milestone Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Requires further investigation by the WPF team.
Projects
None yet
Development

No branches or pull requests

3 participants