Skip to content

ci: Backport master's CI fixes to 6.8 (backport #25725) - #25770

Merged
agneszitte merged 16 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-25725
Oct 28, 2026
Merged

agneszitte merged 16 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-25725

Conversation

@mergify

@mergify mergify Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: related to #23641, #24111, #24604, #24635, unoplatform/uno.check#590 and #24489

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

Every pull request into servicing/6.8 fails CI for reasons that master has already fixed. This backports those fixes. Apart from the crash-report commit, each commit is a cherry-pick of a master commit:

Commits Master source Failure on 6.8
fix(ci): Pin msopenjdk-17 to a version uno-check parses #25680 Android Skia, NativeAOT and CoreCLR builds stop at "Install .NET Workloads": uno-check reports Checkup had Error status: openjdk
fix(macos): Keep WebView script results alive for the callback fda0ac5 (#25093) The macOS Skia runtime tests segfault (exit 139) in Given_WebView2.When_WebMessageReceived. The script completion handler passed pointers into temporary NSStrings that could be freed before the managed callback copied them. Fixes #23641 on 6.8.
The seven fix(macos) commits of #24112 #24112 Native-peer use-after-free crashes (#24111): peers were handed to managed code unowned, and MacOSNativeWebView messaged a freed WKWebView through a stale handle copy.
fix(a11y): Don't scroll when mirroring focus to the DOM and its two tests #24605 WASM: with accessibility on, focusSemanticElement called focus() without preventScroll. The browser scrolled the semantic scroller, and that scroll fed back into the XAML ScrollViewer. This is how Given_TextBox.When_GotFocus_BringIntoView fails on first runs (VerticalOffset 455 or 467, expected 0).
fix(wasm-a11y): Allow disabling accessibility again and test(wasm-a11y): Disable accessibility after each a11y test #24636 WASM: once a Given_Accessible* test turned accessibility on, it stayed on for every later test in the shard. The Given_InputPane occlusion tests then failed whenever they ran after one, e.g. When_OccludedRect_Cleared_Then_Content_Restored: "not brought above the keyboard top". DisableAccessibility() is on the internal WebAssemblyAccessibility type, so there's no new public API.
ci(macos): Print the crash report when the runtime tests crash new A native crash left only "Segmentation fault: 11" in the log. The script now prints the exception and the crashed thread from the .ips report macOS writes.
fix(macOS): Don't over-release NSWindow instances 49f4bcf (#25492) The macOS Skia runtime tests segfault in an autorelease pool drain: NSWindow defaults to releasedWhenClosed = YES, so under ARC AppKit adds an unmatched release when a window closes, and the next owner's release hits a freed window. More frequent on macOS 26, which is why 6.8's lane started crashing when it moved to macos-26.

Differences from master:

  • WebView fix: MacOSNativeWebView.cs on 6.8 had no TryGetHandle guard, so the conflict was resolved by keeping 6.8's code and applying only the fix. Both TaskCompletionSources are created with RunContinuationsAsynchronously. The Objective-C half (UNOWebView.m) applied unchanged.
  • fix(macos): Stop two native-peer use-after-free crashes in CI #24112: two conflicts, both in MacOSNativeWebView.cs, where 6.8 already had RunContinuationsAsynchronously from the WebView fix. Resolved by keeping the disposed-handle guards with that option. The touched files now match master, apart from the namespace rename.
  • fix(wasm-a11y): Allow disabling accessibility again #24636:
    • DisableAccessibility() doesn't reset _relationshipPeers or _relationshipRefreshQueued. Those fields come from master's ARIA relationship refresh, which 6.8 doesn't have.
    • The test commit skips Given_WasmAria and Given_WasmAriaRelations, which don't exist on 6.8.
    • Every 6.8 test class that enables accessibility now disables it in its cleanup.
  • InputPane tests: an earlier revision of this PR disabled three Given_InputPane tests, as master's 9431b99 does. Master has re-enabled them since. With fix(a11y): Don't scroll when mirroring focus to the DOM #24605 and fix(wasm-a11y): Allow disabling accessibility again #24636 they pass on 6.8 too, so they stay enabled here.

The macOS Skia crash

When it started: the macOS lane has crashed in the Given_WebView2 message tests since #24964 moved 6.8's macOS jobs from the macos-15 image to macos-26. The last green run was build 238987 (macos-15), the first red one build 239875 (macos-26).

The crash report (from the new step):

EXC_BAD_ACCESS (SIGSEGV) at 0x20, main thread
  objc_release
  AutoreleasePoolPage::releaseUntil
  objc_autoreleasePoolPop
  -[NSAutoreleasePool drain]
  -[NSApplication run]

That is the stack master's 49f4bcf traced to an over-released NSWindow. The crash lands in whatever test is running when the pool drains, so the WebView2 tests were where it surfaced, not what caused it.

Backported without one line: master's commit also exports NSZombieEnabled=YES in macos-skia-runtime-tests.sh. That line is left out here. A CI run with zombies on and without the fix passed the whole suite, because zombies keep the freed window from being reused. With the line, this lane would pass whether or not the fix works.

Local runs: on macOS 27 (Apple M2), as arm64 and as x64 under Rosetta, the crash never reproduced, so this PR's macOS lane is the check.

Validation

PR Checklist ✅

🤖 Generated with Claude Code


This is an automatic backport of pull request #25725 done by [Mergify](https://mergify.com).

ajpinedam and others added 16 commits October 28, 2026 00:18
(cherry picked from commit 7db730f)
(cherry picked from commit 56800d7)
The script completion handlers passed UTF8String pointers of temporary
NSStrings, which ARC may release before the managed callback copies
them, so the callback could read freed memory: the intermittent SIGSEGV
in the WebView2 ExecuteScriptAsync tests on the macOS WebGPU lane. Hold
the strings until the callback returns, and complete the awaiting task
asynchronously instead of inside WebKit's completion handler.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016JuV6BPjWEEXzuX2RUEE3z
(cherry picked from commit fda0ac5)
(cherry picked from commit c6ddf7b)
A hard SIGSEGV in objc_retain inside libUnoNativeMac killed the whole macOS
Runtime Tests job across 11 different branches, taking the results of every
other test in the run with it.

uno_native_dispose does not deallocate by itself: [element dispose] only calls
removeFromSuperview, and the object dies when [transients removeObject:] drops
the last strong reference. MacOSNativeElement raised that from Unloaded, which
fires on any tree leave including a reparent, yet left NativeHandle pointing at
the freed NSView and Detached untouched. Re-entering the tree then called
uno_native_attach on that pointer, and ARC retained freed memory.

Root-cause fix: disposal is now terminal on both sides. The managed wrapper
zeroes NativeHandle and records Disposed, and uno_native_dispose also removes
the element from `elements` so a disposed view cannot be resurrected by a later
attach through the other strong-reference set.

Defensive hardening: every uno_native_* entry point now refuses a disposed or
zero handle and logs, so an operation fails instead of crashing the process.

Note this does not make a native element survive a reparent — destroying the
peer on Unloaded is a separate design defect, and MediaPlayerElement full-window
toggling still tears its peer down. That is now a logged no-op instead of a
crash.

Compile-validated only: Uno.UI.Runtime.Skia.MacOS builds clean on net10.0. The
Objective-C change and the crash itself need the macOS CI leg to confirm.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tj7eBARpKztfeLfaLTWde7
(cherry picked from commit 9760b68)
(cherry picked from commit 6036927)
`MacOSNativeWebView` kept a private `_webview` copy of the `WKWebView` pointer
alongside the inherited `NativeHandle`. Disposal zeroes `NativeHandle`, but the
shadow field survived it, so the fifteen `uno_webview_*` P/Invokes that read it
kept messaging a deallocated `WKWebView` once the element left the visual tree —
`objc_msgSend` into freed memory, which takes down the process instead of failing
the call.

That is what killed the macOS runtime-test job at
`When_WebMessageReceived_After_RemoveAdd` even with the native-handle guards in
place: those guards cover only the `uno_native_*` surface, which goes through
`NativeHandle`.

The field is gone. Every call resolves the handle through `TryGetHandle`, which
refuses a disposed peer and logs, mirroring `TryGetLiveElement`. Two call-site
choices worth noting: a disposed peer reports no navigation history rather than
keeping a stale `CanGoBack`/`CanGoForward` that would invite a `GoBack()`, and
`ExecuteScriptAsync`/`InvokeScriptAsync` return null instead of allocating a
`GCHandle` whose callback can never fire.

`_registeredHandle` is deliberately not another shadow of the native pointer: it
is only the `_webViews` dictionary key and is never passed to native code. It has
to be remembered because the unload order between the `WebView2` and its native
element is undefined, so reading `NativeHandle` in `OnUnloaded` can find it
already zeroed and leave a stale entry behind.

This does not make a WebView2 survive a reparent — the peer really is gone, so
`When_WebMessageReceived_After_RemoveAdd` now fails its assert instead of
crashing the host. That is the point: the shard writes its results file and the
rest of the suite reports.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit ef4af74)
(cherry picked from commit 8afcba6)
- Fix TaskCompletionSource<string> to TaskCompletionSource<string?> in
  ExecuteScriptAsync so it matches the callback cast
- Guard content?.GetType() in TryGetLiveElement to avoid NullReferenceException
  when content is null
- Return new Size(0, 0) from MeasureNativeElement for disposed peers instead
  of Size.Empty (-∞, -∞) which caused layout exceptions

Co-authored-by: MartinZikmund <[email protected]>
(cherry picked from commit d6462d4)
(cherry picked from commit 8434b61)
`TryGetLiveElement` and `TryGetHandle` are reached on every arrange, measure,
attach and detach of a reparented element, so `Error` put a per-layout-pass stream
into the channel reserved for genuine faults. The disposed peer is a known
degraded path, not an unexpected state.

Also from review:

- `DisposeNativePeer` skips the P/Invoke when the handle is already zero, which
  happens when the peer was never created.
- `ExecuteScriptAsync` awaits inside the `token.Register` scope, matching
  `InvokeScriptAsync`. It previously disposed the registration before awaiting, so
  a cancel arriving after the P/Invoke never reached the pending task.
- Records why the disposed-peer measure fallback cannot be `Size.Empty`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TEzBHbVj75RX9ENGARb6sL
(cherry picked from commit f81eec0)
(cherry picked from commit a3f2680)
`MacOSNativeElement` destroyed its NSView from `Unloaded`, but `Unloaded` also
fires on a reparent and the framework re-enters the very same element through
`AttachNativeElement`. Every operation on the way back in was then refused, so a
`WebView2` removed from and re-added to the tree came back dead — which is why
`When_WebMessageReceived_After_RemoveAdd` failed the macOS runtime-test job. The
X11 and Win32 hosting extensions never destroyed their peer on unload either.

Root-cause fix: the peer's lifetime follows the managed wrapper. The finalizer
releases it, dispatched to the main thread since AppKit is main-thread only, and
`uno_native_attach` drops the strong reference `uno_native_detach` took so
`transients` holds only genuinely detached views. The disposed-handle guards stay
as hardening — they can no longer be reached through a reparent.

`addScriptMessageHandler:name:` raises on a name that is already registered, and
the WKWebView now survives the round trip, so registration removes the previous
handler first and `OnUnloaded` unregisters symmetrically with `OnLoaded`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014LKUHFiW2J8nNFy7FmuCsd
(cherry picked from commit bbf1ec8)
(cherry picked from commit c8b30e6)
`uno_webview_create`, `uno_mediaplayer_create_view` and `uno_native_create_sample`
all end in `objc_autoreleaseReturnValue` (confirmed in the shipped dylib), so the
handle they hand back is owned by nothing but the current autorelease pool. The
native side only took a strong reference at `uno_native_attach`, which adds the
view to `elements`. Any element that is never attached, or whose attach lands in a
later run-loop turn than its creation, is therefore already deallocated — and both
`uno_native_attach` and `uno_native_dispose` begin with an ARC `objc_retain` of
their parameter, so the next call takes the process down at `+0x1f`.

That is the SIGSEGV the macOS runtime-test job keeps hitting: three CI core dumps
from this branch all fault at the same image offset, which symbolizes to
`uno_native_dispose` retaining a freed NSView.

`uno_native_track` takes the strong reference at creation instead. The peer is now
owned continuously — `transients` from creation, `elements` while attached, back to
`transients` on detach — until `uno_native_dispose` drops both and deallocates it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014LKUHFiW2J8nNFy7FmuCsd
(cherry picked from commit 3a8a41e)
(cherry picked from commit 1a9e08d)
`drawInMTKView:` returned without calling managed code when `currentDrawable` was
nil. The view runs with `enableSetNeedsDisplay`, so AppKit had already cleared
`needsDisplay` to make that call, and the managed side latches its own request:
`CompositionTarget.RequestNewFrame` sets `RenderRequested` and only clears it from
`OnNativePlatformFrameRequested`, which the dropped frame never reaches. Every
later `RequestNewFrame` then coalesced into an invalidation that had already been
consumed, so a single nil drawable stopped the window rendering permanently.

Anything awaiting a frame after that waits forever — `UITestHelper.WaitForRender`
has no timeout of its own — which is how one macOS test takes the whole 60-minute
job down with it and publishes no results.

The nil case now re-arms `needsDisplay` on a later main-queue turn, so the frame
request survives. The software path never had the defect: it calls the managed
callback before its own early return.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014LKUHFiW2J8nNFy7FmuCsd
(cherry picked from commit 3d9731b)
(cherry picked from commit c50017f)
Focusing a semantic node let the browser scroll its semantic scroller
to reveal it, and the scroll listener fed that offset back into the
ScrollViewer. Programmatic focus of an off-screen element then scrolled
the XAML content, flaking Given_TextBox.When_GotFocus_BringIntoView on
WASM once accessibility is enabled.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 92ec8c3)
(cherry picked from commit 3cb0760)
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 1abd4e0)
(cherry picked from commit 4eac54b)
Review feedback addressed 2026-10-09.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NHPnucPE4WuxBEhL1RJG2T
(cherry picked from commit 7c06b30)
(cherry picked from commit 7fab2bc)
A native crash in the desktop macOS runtime tests leaves no results and
no stack in the log, only "Segmentation fault: 11". Print the exception
and the crashed thread's frames from the report macOS writes to
~/Library/Logs/DiagnosticReports, then fail with the original exit code.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 18e369c)
EnableAccessibility had no counterpart, so the semantic DOM, focus sync,
native-focus suppression and live regions stayed on for the rest of the
app. DisableAccessibility tears all of it down and brings the enable
button back, so it can be turned on again.

The ItemsRepeater, ListView and ContentDialog handlers are now detachable
so a re-enable does not subscribe them twice.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Da9FjW3KpXk99Zo4YyViTE
(cherry picked from commit 00377f7)
(cherry picked from commit 21866ee)
The accessibility tests left it on for every later test in the WASM app,
slowing them down and making a TextBox focus bounce through the semantic
DOM. Each a11y test class now disables it in its cleanup, and new tests
cover disabling and re-enabling.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Da9FjW3KpXk99Zo4YyViTE
(cherry picked from commit 86905c8)
(cherry picked from commit 489d850)
NSWindow defaults to releasedWhenClosed = YES, and uno_window_create never
turned it off. Under ARC, with the static windows set holding the strong
reference, AppKit then adds one unmatched release when the window closes,
deferred to the autorelease pool. When -[NSApplication run] drains the
pool, the window is freed while its owners still point at it, and the
next release crashes in objc_release inside
AutoreleasePoolPage::releaseUntil: the macOS Skia runtime-test crash
6.8 has hit since moving to the macos-26 image.

Turn it off, and remove the window from the set once it has closed.

Backport of master's 49f4bcf without its NSZombieEnabled change to
macos-skia-runtime-tests.sh: zombies alone hide this crash, so the lane
would not show whether the fix works.

(cherry picked from commit 49f4bcf)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit c71ab62)
@CLAassistant

CLAassistant commented Oct 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
4 out of 5 committers have signed the CLA.

✅ MartinZikmund
✅ ramezgerges
✅ ajpinedam
✅ Xiaoy312
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Oct 28, 2026
@mergify mergify Bot mentioned this pull request Oct 28, 2026
2 of 5 tasks
@agneszitte
agneszitte merged commit 77b01fc into release/stable/6.7 Oct 28, 2026
11 of 13 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-25725 branch October 28, 2026 00:20
agneszitte added a commit that referenced this pull request Oct 28, 2026
…heads

Given_WasmAccessibilityLifecycle (from #25770) uses WasmSemanticDomHelper,
which the native Android and WASM heads don't build, so they failed with
CS0234. Exclude it like the other Given_Accessible* tests there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants