Repository navigation
fix(win32): Correct UIA structure event ABI (backport #25985) - #26025
Closed
mergify[bot] wants to merge 6 commits into
Closed
mergify[bot] wants to merge 6 commits into
mergify[bot] wants to merge 6 commits into
Conversation
(cherry picked from commit 202843b)
(cherry picked from commit c2ced45)
(cherry picked from commit 11e3774)
UiaDisconnectProvider calls back into the provider it disconnects, including Navigate(Parent), even when no UIA client has subscribed to the app's events. While CleanupProviders runs, GetOrCreateProviderForResolvedPeer still checked the cleanup gate before its element-keyed match and could create a peer and write the lookup tables (RegisterPopupPanelAlias), while GetOrCreateProvider and GetProvider tried only the element key, missing providers registered by peer. During cleanup all three now use one lookup: the peer key, then the owner's element key when its provider represents the same peer. It never creates a peer or a provider and never registers an alias. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit e4c9bfc)
Delete the probe's marker folder when it finishes, correct the comment on why the client runs out of process, and join the marker paths with Path.Join in the runtime test too. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 973de7a)
When_Native_Client_Observes_Structure_Changes is inconclusive without an out-of-process UIA client, so restoring the SAFEARRAY signature of UiaRaiseStructureChangedEvent passed every runtime test. Run Win32UiaEventProbe after the Windows Skia runtime tests and publish its results. Locally, with the signature reverted, the probe fails with the access violation (0xC0000005) while the regular run stays green. CI installs only the .NET 11 SDK, so the probe rolls forward to the next major runtime, as Uno.NUnitTransformTool does. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 068ed8f)
4 of 5 tasks
Contributor
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
Contributor
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-26025/docs/index.html |
Contributor
|
The build 243534 did not find any UI Test snapshots differences. |
Member
|
Auto synced |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue: related to unoplatform/kahua-private#564
PR Type:
🐞 Bugfix
What changed? 🚀
1. Structure-event ABI (the crash). While a UI Automation client is subscribed to structure changes, removing an element can crash in
UiaRaiseStructureChangedEventwith an access violation (0xC0000005). The native signature is(IRawElementProviderSimple*, StructureChangeType, int* pRuntimeId, int cRuntimeIdLen). Our P/Invoke marshalled the runtime ID as a SAFEARRAY and omitted the length, so onlyChildRemoved, which carries a runtime ID, crashed. The P/Invoke now passes anint[]plus its length, and 0 for a null runtime ID. No other P/Invoke inWin32UIAutomationInterop.cshas this mistake:UiaRaiseTextEditTextChangedEventreally does take aSAFEARRAY*.2. Lookups during provider cleanup (behaviour change).
UiaDisconnectProvidercalls back into the provider it is disconnecting:ProviderOptions,HostRawElementProvider,GetPropertyValue,Navigate(Parent),GetRuntimeIdandFragmentRoot. It does this even when no client has subscribed to the app's events.Navigate(Parent)resolves the parent throughGetProviderForPeer/GetOrCreateProvider. On master these lookups returned null whileCleanupProvidersran, even for a parent whose provider was still connected.During cleanup, the three lookups (
GetOrCreateProvider,GetProvider,GetOrCreateProviderForResolvedPeer) now share one lookup-only path:Creation stays blocked during cleanup, so a callback can't create a provider for an element that was just cleaned.
3. CI coverage of the ABI fix.
When_Native_Client_Observes_Structure_Changesneeds an out-of-process UIA client. A regular runtime-test run therefore reports it as inconclusive. The Windows Skia runtime-test job now runsbuild/test-scripts/Win32UiaEventProbeafter the main run and publishes its results.Validation
Runtime (Skia Win32, local,
Given_Win32ProviderLifetime):Win32UiaEventProbeChildAddedandChildRemovedmatched the runtime ID0xC0000005, and the probe failedWhen_Cleanup_Reenters_Live_Provider_Lookupfailed (provider registered only by its peer)Compile: desktop SamplesApp, Release
net10.0-desktop.Earlier evidence from the 6.x lines:
servicing/6.8crashed with0xC0000005in the three-argument call under the same subscription.servicing/6.8. Their fix (the provider cleanup from feat(a11y): WinUI-parity accessibility fixes for Skia (Win32/macOS/WASM) #23722) is already on master, not in this PR.servicing/6.8andrelease/stable/6.7candidates passed 6/6 with the probe.Not resolved by this PR: the Kahua retention. In the Kahua desktop app (Uno.WinUI 6.7.135 with the patched 6.7 Win32 runtime), Close Record Detail unloads the view. The view's weak reference still survives repeated full GC and finalizer waits, even after the native client detaches (36 structure events received). That retention is tracked separately on the issue. This PR fixes the crash and the cleanup lookups, so it does not close the issue.
To run the native regression locally after building SamplesApp:
Backports:
release/stable/7.0via Mergify.servicing/6.8andrelease/stable/6.7get separate PRs: the 6.x code differs, and those PRs also carry the provider-cleanup part of #23722.PR Checklist ✅
Screenshots Compare Test Runresults. The 2458 changed snapshots also appear on fix(AnimatedIcon): Don't root the icon from its Foreground brush or State ancestor #25948, fix: Subscribe to Command.CanExecuteChanged weakly #25965 and fix(NavigationView): Don't root menu items from the SplitView #25968, so they're baseline noise; this PR has no visual change.This is an automatic backport of pull request #25985 done by [Mergify](https://mergify.com).