Skip to content

fix(automation): Use qualified ClassName for controls-library peers - #26234

Merged
MartinZikmund merged 2 commits into
masterfrom
dev/doti/peers-props-classname
Nov 19, 2026
Merged

MartinZikmund merged 2 commits into
masterfrom
dev/doti/peers-props-classname

Conversation

@morning4coffe-dev

Copy link
Copy Markdown
Member

GitHub Issue: closes #24992

PR Type:

🐞 Bugfix

What changed? 🚀

The controls-library peers (controls/dev/* in WinUI) return winrt::hstring_name_of<T>() from GetClassNameCore, which is the namespace-qualified name, e.g. Microsoft.UI.Xaml.Controls.InfoBar. When they were ported, that became nameof(T), so 18 peers reported just InfoBar, TabView, and so on. Tools that match on ClassName (UI test frameworks, Accessibility Insights rules) saw different values than on WinUI.

  • The 18 peers now return typeof(T).FullName, like Expander, NumberBox and SplitButton already did. ColorSpectrum correctly comes out as Microsoft.UI.Xaml.Controls.Primitives.ColorSpectrum.
  • MenuBarAutomationPeer had an Uno-only GetClassNameCore returning "MenuBar". WinUI's MenuBarAutomationPeer.cpp has no override, so it's removed. This means MenuBar now reports "", not a qualified name as the issue suggested.
  • FrameworkElementAutomationPeer.m_ClassName defaulted to null. WinUI's constructor sets it to L"", so it's string.Empty now.

Tests: Given_ControlsLibraryAutomationPeerClassName has a row per control (27, including the ones that were already right), plus one for the base FE peer.

Behavior change: UI tests that matched on the short ClassName will need the qualified name, the same value they'd get on WinUI.

MediaPlayerElementAutomationPeer.GetClassNameCore returns nameof(MediaPlayerElementAutomationPeer), which also looks wrong, but it isn't part of the controls library, so I left it out of this PR.

PR Checklist ✅

🤖 Generated with Claude Code

@morning4coffe-dev morning4coffe-dev self-assigned this Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 19s —— View job


Review summary

Verdict: ship. I found no blocking issues, so I posted no inline comments (0 high, 0 medium, 0 low).

Code review assessment (by inspection only; I did not build or run tests):

  • The 18 nameof(T) → typeof(T).FullName! changes are mechanical. They match the existing Expander, NumberBox and SplitButton peers.
  • Removing the Uno-only MenuBarAutomationPeer.GetClassNameCore and defaulting m_ClassName to string.Empty follow the WinUI sources as the PR describes them. I did not check the WinUI sources myself.
  • I grepped src/ for code that matches on the old short names. SamplesApp.UITests only uses WaitForElement("ProgressRing"), which is an element id rather than a ClassName match. Nothing in the repo appears to depend on the old values.
  • The test is a single parameterized [TestMethod] with [DataRow] rows, [RunsOnUIThread] and [GitHubWorkItem]. It is synchronous and correctly stays void. It follows the runtime-tests rules.

Non-blocking notes:

  • The PR checklist ticks "NO breaking changes", but the description also says UI tests matching the short ClassName will need updating. Consider unticking that box or rewording it. A release-note mention would also help consumers.
  • MediaPlayerElementAutomationPeer is left out of scope, as the PR says. A follow-up issue would keep it from being forgotten.
  • Runtime validation is outstanding. Please confirm Given_ControlsLibraryAutomationPeerClassName passes in CI on Skia Desktop and WASM.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 10s —— View job


Review summary

Verdict: ship. 0 high, 0 medium, 0 low. No inline comments posted.

Code review (by inspection only; I did not build or run tests):

  • The 18 nameof(T) → typeof(T).FullName! changes are mechanical and match the existing Expander, NumberBox and SplitButton peers.
  • Removing the Uno-only MenuBarAutomationPeer.GetClassNameCore means MenuBar now inherits the empty class name. This matches the PR description.
  • m_ClassName = string.Empty removes a null return from the base peer.
  • Given_ControlsLibraryAutomationPeerClassName follows the runtime-test conventions: [RunsOnUIThread], [GitHubWorkItem], DataRow per control. The #if HAS_UNO guard for PagerControl is reasonable and is not a skipped test.

Non-blocking notes:

  • The checklist ticks "NO breaking changes", but the description says UI tests matching the short ClassName need updating. Consider unticking it and adding a release note.
  • MediaPlayerElementAutomationPeer is left out of scope. A follow-up issue would keep it from being forgotten.
  • Runtime validation is still pending. Please confirm the new tests pass in CI on Skia Desktop and WASM.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 244695 found UI Test snapshots differences: skia-linux-screenshots: 205, skia-windows-screenshots: 257

Details
  • skia-linux-screenshots: 205 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppWindowTitleBar Properties.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • AnimatedBackVisualSourceSamplePage.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • AnimatedVisualsTestbedPage.png
    • AppWindowTitleBar Properties.png
    • AutomationProperties_StructureAndProps.png-dark
  • skia-windows-screenshots: 257 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedVisualsTestbedPage.png-dark
    • AutomationProperties_StructureAndProps.png-dark
    • Basics.png-dark
    • Basics.png
    • AnimatedVisualsTestbedPage.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AutomationProperties_AutomationId.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png

@morning4coffe-dev
morning4coffe-dev force-pushed the dev/doti/peers-props-classname branch from c941e22 to 727000a Compare November 9, 2026 21:25
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 10s —— View job


Review summary

Verdict: ship. 0 high, 0 medium, 0 low. No inline comments posted.

Code review (by inspection only; I did not build or run tests):

  • I re-read the diff against origin/master. The 18 nameof(T) → typeof(T).FullName! changes are mechanical and match the existing Expander, NumberBox and SplitButton peers.
  • Removing MenuBarAutomationPeer.GetClassNameCore means MenuBar now reports "", as the description says.
  • m_ClassName = string.Empty removes a null return from the base peer.
  • The new test follows the runtime-test conventions.

Non-blocking notes:

  • The checklist ticks "NO breaking changes", but the description says UI tests matching the short ClassName need the qualified name. Consider unticking it and adding a release note.
  • MediaPlayerElementAutomationPeer is out of scope, as the PR says. A follow-up issue would keep it from being forgotten.
  • The Skia screenshot comparison reports 205 differences on Linux and 257 on Windows across unrelated samples. That looks like baseline noise, since this change doesn't touch rendering, but please confirm it before merge.
  • Runtime validation is still pending. Please confirm Given_ControlsLibraryAutomationPeerClassName passes in CI.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 244948 found UI Test snapshots differences: skia-linux-screenshots: 224, skia-windows-screenshots: 272

Details
  • skia-linux-screenshots: 224 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AppWindowTitleBar Properties.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • AnimatedVisualsTestbedPage.png
    • AppWindowTitleBar Properties.png-dark
    • AutomationProperties_StructureAndProps.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • AnimatedBackVisualSourceSamplePage.png
    • AutomationProperties_StructureAndProps.png-dark
    • Basics.png-dark
    • Basics.png
    • CalendarView_Theming.png-dark
    • Buttons.png-dark
    • CalendarView_Theming.png
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
  • skia-windows-screenshots: 272 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • AnimatedVisualsTestbedPage.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AnimatedVisualsTestbedPage.png-dark
    • AppWindowTitleBar Properties.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • AnimatedBackVisualSourceSamplePage.png-dark

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@MartinZikmund MartinZikmund left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Checked all 27 controls/dev/**/*AutomationPeer.cpp overrides. Every touched peer returns winrt::hstring_name_of<T>() there, so typeof(T).FullName matches 1:1, and ColorSpectrum correctly comes out under .Primitives. The MenuBar removal and m_ClassName = string.Empty match WinUI too (MenuBarAutomationPeer.cpp has no override, and the FrameworkElementAutomationPeer ctor does m_ClassName.Set(L"")). LGTM.

Optional nits:

  • About MediaPlayerElementAutomationPeer in the description: it's actually right. WinUI's MediaPlayerElementAutomationPeer_Partial.cpp literally returns L"MediaPlayerElementAutomationPeer" (same for NamedContainerAutomationPeer), so no follow-up needed there.
  • When_Peer_Created_Then_ClassName_Is_Namespace_Qualified now also covers the MenuBar "" row, so a more neutral name like ..._Then_ClassName_Matches_WinUI would fit better.

@MartinZikmund
MartinZikmund merged commit c0659d9 into master Nov 19, 2026
52 checks passed
@MartinZikmund
MartinZikmund deleted the dev/doti/peers-props-classname branch November 19, 2026 06:57
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.

Automation peers of WinUI controls-library controls return a short ClassName instead of the namespace-qualified one

4 participants