dotnet / dotnet/wpf

DependencyProperty tests are ignoring multiple variance of ArgumentException

Open
#10,323 0 comments 0 reactions 1 assignee Claimed by @h3xds1nz View on GitHub
Investigate Test or Test Infrastructure
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### The issue

In the new tests from #8215 for `DependencyProperty`, there's a lot of re-use of data that are being passed to `Register` methods of `DependencyProperty`.

This would be fine on its own when testing for other things, but in tests specifically for `Register` methods, an `ArgumentException` can be thrown either because the property was already registered (`SR.PropertyAlreadyRegistered`) or when auto generation of default property metadata fails (`SR.DefaultValueAutoAssignFailed`).

This can cause flaky unit test results that do not clearly express where the problem is and require further debugging.

### Failure example

For example, `Register_InvokeStringTypeTypeValidateFail_Throws` will fail if ran together with `Register_InvokeStringTypeType_Success` on the `callCount` assertion, because `Register` throws `ArgumentException`,
however due to the fact that the property was previously registered, not because the actual test case fails.

### Other information

I will fix these myself by proper comparison of resource messages but I guess that will require first fixing the correct internals visibility between WindowsBase and WindowsBase.Tests or my VS is flaky at the moment. Assign to me please as I cannot without triage rights.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.