Repository navigation
Description
Current behavior 🐛
The macOS Skia runtime-test leg (macOS 26, x64) intermittently crashes with a native segmentation fault (SIGSEGV, process exit code 139) while running the Given_WebView2.When_ExecuteScriptAsync* tests. The crash aborts the whole test run.
The failure surfaces at a test-to-test transition. The last log lines before the crash:
Running test When_ExecuteScriptAsync_Non_String()
build/test-scripts/macos-skia-runtime-tests.sh: line 21: NNNNN Segmentation fault: 11 dotnet SamplesApp.Skia.Generic.dll --runtime-tests=$TEST_RESULTS_FILE
##[error]Bash exited with code '139'.
The crash is in the native macOS WebView2 layer (Uno.UI.Runtime.Skia.MacOS, MacOSNativeWebView / UNOWebView). The CI log contains no backtrace — Release native code currently has no diagnostic channel, so the fault is a bare "Segmentation fault: 11" with no symbols.
Expected behavior 🎯
The Given_WebView2 runtime tests run to completion without a native crash.
How to reproduce it (as minimally and precisely as possible) 🔬
Observed only on the CI macOS 26 / x64 Skia runtime-test leg; intermittent. No minimal repro app — this is a framework-internal runtime-test crash.
It has not been reproducible locally: ~65 runs of the When_ExecuteScriptAsync* family on a matching macOS 26.4.1 / x64 machine (plain Release, plus NSZombieEnabled and MallocScribble) all passed. The narrow race appears to need the load/timing of a CI runner.
Workaround 🛠️
None required for end users — this affects the CI runtime-test run, not app runtime behavior.
Renderer 🎨
- Skia
Affected platforms 📱💻🖥️
Desktop (macOS)
Uno.Sdk version (and other relevant versions) 📦
Framework master. Toolchain: .NET SDK 10.0.201, Xcode 26.0.1 (macOS 26.0 SDK), macOS 26.4.1 x64.
IDE version 🧑💻
N/A (CI / dotnet CLI).
Anything else we need to know? 💬
Investigation notes (leading suspect, not yet confirmed):
uno_webview_get_titledoesstrdup(webview.title.UTF8String).WKWebView.titleis nullable; if it isnil,[nil UTF8String]returnsNULLandstrdup(NULL)dereferences null →SIGSEGV. It is the only unguarded raw-pointer-from-nil inUNOWebView.m(URL callbacks passNULLsafely to null-checking managed code). It is reachable viaDocumentTitle→CheckForTitleChangeon title-change KVO / navigation finish.- However, this could not be reproduced locally: reading
DocumentTitleon a fresh web view returns""(title is not nil), and instrumentation showedtitlewas nevernilacross ~70 navigations. So the nil-title path is a real latent defect but is not confirmed to be this crash; the true cause remains open (candidates include a teardown use-after-free or theevaluateJavaScriptcompletion/GCHandle path).
A defensive PR guards the nullable title (webview.title ?: @"") and adds a When_DocumentTitle_Before_Navigation behavior test. Because the crash cannot be reproduced locally, that PR is hardening — CI will indicate whether the crash recurs. Improving native diagnosability (a backtrace / DiagnosticReports capture on the macOS runtime-test leg) would make the next occurrence actionable.
Activity
MartinZikmund commentedon Oct 11, 2026
Root cause for this crash is now known, and it is still present on the 6.x branches.
Cause (code inspection plus CI evidence, not reproduced locally):
uno_webview_execute_scriptanduno_webview_invoke_scriptinUNOWebView.mpassUTF8Stringpointers of temporaryNSStrings to the managed callback, for exampler = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] UTF8String];,r = quoted.UTF8String;ande = error.description.UTF8String;. Under ARC the temporary string can be released before the callback copies the bytes, so the callback reads freed memory. That matches the intermittent SIGSEGV inWhen_ExecuteScriptAsync*, which is a use-after-free, not the niltitlepath.Master: fixed by #25093 (closes #25092), which keeps the strings alive until the callback returns (
NS_VALID_UNTIL_END_OF_SCOPE) and completes the awaiting task asynchronously.6.x:
release/stable/6.7still has the old code (theUTF8Stringlines inuno_webview_execute_scriptanduno_webview_invoke_script). On the macOS 26 image, 3 of 3 runs of the Skia macOS runtime tests on the 6.7 backport PR (#24965) segfaulted right afterMacOSNativeWebView LoadHtmlString, inWhen_ExecuteScriptAsync_Has_No_ResultandWhen_ExecuteScriptAsync_Non_String. Backporting #24112 alone did not help. The same tests pass on master.#24964 and #24965 work around this by excluding the five
ExecuteScriptAsynctests onSkiaMacOS. Backporting the #25093 native fix toservicing/6.8andrelease/stable/6.7should let those exclusions be dropped.