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
{{ message }}
Repository navigation
Lite test flake: ScreenReaderNamesFollowUpTests hits a WPF dictionary from two threads #5559
A Lite test failed in CI with a corrupted WPF dictionary. The test it hit, ScreenReaderNamesFollowUpTests.HiddenElementsInATemplatedCell_AreNotContent, does not touch the code the PR changed.
What failed:
InvalidOperationException : Operations that change non-concurrent collections must have exclusive access.
at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
at MS.Internal.ComponentModel.DependencyObjectPropertyDescriptor.AddValueChanged(Object component, EventHandler handler)
at PerformanceMonitor.Ui.AccessibleNames.ActivateCell(DataGridCell cell) (AccessibleNames.cs:168)
Seen once, on 2026-10-08, in a pull request's Lite shard 0 (1 of 673 failed). It has not been seen on dev yet.
The likely cause, not yet proven: the test builds its window on an STA thread of its own (OnStaThread, ScreenReaderNamesFollowUpTests.cs:33). Other Lite test classes do the same and run in parallel. AddValueChanged goes through a static WPF cache that is not safe for two threads at once. In the app there is one UI thread, so this is a test problem, not a product one.
To fix: run the Lite tests that build WPF elements one at a time, in one shared xUnit collection or on one shared STA thread. Keep every existing check. Show the failure on purpose first, at head and at the base, then show the fix holds.
Seen again on 2026-10-08, on the same pull request's rerun of Lite shard 0. This time the test was ScreenReaderRowNamesTests.AGridRow_SkipsHiddenColumnsAndReadsTemplatedColumns_AndFollowsTheDisplayOrder, with the same error from the same WPF dictionary. That is two failures in two attempts on that shard, while three other pull request runs on the same dev passed it. A second test class hitting the same error fits the cause above: two test classes building WPF elements at the same time.
Fixed by #5567, merged into dev. The Lite and Viewer test classes that build WPF elements on their own UI thread now take one shared gate, so no two of them use WPF's shared property cache at once. A census in each test project fails when a new class starts a UI thread outside the gate. Claude posting for Erik Darling.
Activity
erikdarlingdata commentedon Oct 8, 2026
Seen again on 2026-10-08, on the same pull request's rerun of Lite shard 0. This time the test was ScreenReaderRowNamesTests.AGridRow_SkipsHiddenColumnsAndReadsTemplatedColumns_AndFollowsTheDisplayOrder, with the same error from the same WPF dictionary. That is two failures in two attempts on that shard, while three other pull request runs on the same dev passed it. A second test class hitting the same error fits the cause above: two test classes building WPF elements at the same time.
Claude posting for Erik Darling.
Lite and Darling WPF tests take one gate so parallel STA classes stop…
erikdarlingdata commentedon Oct 8, 2026
Fixed by #5567, merged into dev. The Lite and Viewer test classes that build WPF elements on their own UI thread now take one shared gate, so no two of them use WPF's shared property cache at once. A census in each test project fails when a new class starts a UI thread outside the gate. Claude posting for Erik Darling.
STA test helpers take the WPF STA gate (#5559 census) (#5562)