Repository navigation
[Android] Fix WebView SIGSEGV crash in GLFunctorDrawable on ScrollView overscroll (#38080) - #38181
ne0rrmatrix wants to merge 7 commits into
Conversation
…w overscroll (dotnet#38080) A non-null ClipBounds on an attached WebView routes its compositing through the AOSP hwui RenderThread GL-functor path (GLFunctorDrawable). When a fixed-size WebView sits mid-list in a ScrollView and is scrolled off-screen, an overscroll (or back-navigation) makes the device clip degenerate and GLFunctorDrawable::onDraw SIGSEGVs. UpdateClipBounds previously set a persistent (0,0,w,h) ClipBounds for non-wrapper fixed-size WebViews, so the WebView stayed on the GL-functor path for its whole lifetime and crashed on overscroll. The auto-sizing latch added for dotnet#35771 only covered zero-dimension states, so a sized WebView (e.g. HeightRequest=220) never hit it. Null the ClipBounds once the WebView has a real size. The pre-layout full-screen flash from dotnet#31475 is already covered by the zero clip set in the constructor before the view is attached, so null is safe here and removes the WebView from the GL-functor path. Applied to both MauiWebView and MauiHybridWebView (BlazorWebView). Adds an Issue38080 UITest repro.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38181Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38181" |
|
Hey there @@ne0rrmatrix! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey there @ne0rrmatrix! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
The new UI test currently scrolls in the opposite directions from what its comments claim, so it may not reliably exercise both overscroll extremes (and may miss the regression it’s meant to guard).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes an Android native RenderThread SIGSEGV involving GLFunctorDrawable when a ScrollView contains an off-screen WebView that is overscrolled (regression introduced by persistent non-null ClipBounds behavior).
Changes:
- Update Android
MauiWebViewandMauiHybridWebViewto clearClipBoundsonce the view has a real (non-zero) size, avoiding the GL-functor path implicated in the crash. - Add a new HostApp repro page (
Issue38080) that matches the reported crash scenario (fixed-size WebView mid-list in a ScrollView). - Add a new UI test (
Issue38080) intended to exercise overscroll + back navigation crash vectors.
Note: The PR description is detailed and appears consistent with the implementation; it does not include the repo-required NOTE block at the top of the description.
File summaries
| File | Description |
|---|---|
| src/Core/src/Platform/Android/MauiWebView.cs | Clears ClipBounds after real sizing to avoid GL-functor crash path. |
| src/Core/src/Platform/Android/MauiHybridWebView.cs | Same ClipBounds behavior adjustment for HybridWebView. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue38080.cs | Adds a navigation-based repro page with a fixed-size mid-list WebView in a ScrollView. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cs | Adds an Android-only UI test intended to overscroll extremes and back-navigate without crashing. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The new UITest can silently skip the critical scrolling actions if the ScrollView element lookup fails, risking a false-negative regression test.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cs:23
- The scroll operations can silently no-op if the ScrollView element isn’t found (HelperExtensions.ScrollUp/Down only execute when the resolved element is non-null). Since this test’s pass condition doesn’t otherwise depend on scrolling, it could become a false-negative if the AutomationId lookup fails on a given platform/build. Add an explicit wait for the ScrollView before attempting to scroll so the test fails reliably if the container can’t be located.
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Addressed both Copilot review points:
Verified on an Android emulator (API 35, x86_64) using the official cake flow: |
There was a problem hiding this comment.
🟡 Changes recommended
The PR description is missing the repository-required NOTE block at the very top (per the PR description template guidance).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The new UITest doesn’t currently assert it actually reached the overscroll extremes, which can allow false-positive passes if scroll gestures are flaky or no-op on some devices.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@ne0rrmatrix — new AI review results are available based on commit
9c58efd.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: ANDROID · Base: main · Merge base: 699f16e4
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 WebViewHandlerTests (DisconnectHandlerDestroysNativeWebView) Category=WebView |
✅ FAIL — 450s | ✅ PASS — 382s |
🖥️ Issue38080 Issue38080 |
✅ FAIL — 657s | ✅ PASS — 657s |
🔴 Without fix — 📱 WebViewHandlerTests (DisconnectHandlerDestroysNativeWebView): FAIL ✅ · 450s
(no coded error found; showing last 1200 chars)
"totalMemoryBytes": 8327327744
},
"target": {
"kind": "emulator",
"name": "sdk_gphone_x86_64",
"identifier": "emulator-5554",
"operatingSystem": "Android",
"operatingSystemVersion": "11",
"apiLevel": 30,
"architecture": "x86_64",
"supportedArchitectures": [
"x86_64",
"x86",
"arm64-v8a",
"armeabi-v7a",
"armeabi"
],
"manufacturer": "Google",
"model": "sdk_gphone_x86_64",
"productName": "sdk_gphone_x86_64",
"buildFingerprint": "google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys",
"cpuModel": "0",
"cpuMaxFrequencyHertz": 2000,
"totalMemoryBytes": 2077544448
}
}
}
<<XHARNESS_RESULT_END>>
info: Attempting to remove apk 'com.microsoft.maui.core.devicetests'..
info: Successfully uninstalled com.microsoft.maui.core.devicetests
XHarness exit code: 1 (TESTS_FAILED)
Passed: 0
Failed: 1
Skipped: 0
Total: 1
Tests completed with exit code: 1
🟢 With fix — 📱 WebViewHandlerTests (DisconnectHandlerDestroysNativeWebView): PASS ✅ · 382s
(no coded error found; showing last 1200 chars)
265000,
"totalMemoryBytes": 8327327744
},
"target": {
"kind": "emulator",
"name": "sdk_gphone_x86_64",
"identifier": "emulator-5554",
"operatingSystem": "Android",
"operatingSystemVersion": "11",
"apiLevel": 30,
"architecture": "x86_64",
"supportedArchitectures": [
"x86_64",
"x86",
"arm64-v8a",
"armeabi-v7a",
"armeabi"
],
"manufacturer": "Google",
"model": "sdk_gphone_x86_64",
"productName": "sdk_gphone_x86_64",
"buildFingerprint": "google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys",
"cpuModel": "0",
"cpuMaxFrequencyHertz": 2000,
"totalMemoryBytes": 2077544448
}
}
}
<<XHARNESS_RESULT_END>>
info: Attempting to remove apk 'com.microsoft.maui.core.devicetests'..
info: Successfully uninstalled com.microsoft.maui.core.devicetests
XHarness exit code: 0
Passed: 1
Failed: 0
Skipped: 0
Total: 1
Tests completed successfully
🔴 Without fix — 🖥️ Issue38080: FAIL ✅ · 657s
Error-relevant lines (filtered from the build log):
at Microsoft.Maui.TestCases.Tests.Issues.Issue38080.<AssertFixedSizeWebViewIsMeasuredAndHardwareAccelerated>b__8_0() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cs:line 98
at UITest.Appium.HelperExtensions.RetryAssert(IApp app, Action assertToRetry, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 965
at Microsoft.Maui.TestCases.Tests.Issues.Issue38080.AssertFixedSizeWebViewIsMeasuredAndHardwareAccelerated() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cs:line 89
at Microsoft.Maui.TestCases.Tests.Issues.Issue38080.OffScreenWebViewInScrollViewShouldNotCrashOnOverscroll() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cs:line 29
🟢 With fix — 🖥️ Issue38080: PASS ✅ · 657s
(no coded error found; showing last 1200 chars)
..
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.13)
[xUnit.net 00:00:00.13] Discovering: Controls.TestCases.Android.Tests
[xUnit.net 00:00:00.40] Discovered: Controls.TestCases.Android.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 09/10/2026 22:47:39 FixtureSetup for Issue38080(Android)
>>>>> 09/10/2026 22:47:42 OffScreenWebViewInScrollViewShouldNotCrashOnOverscroll Start
>>>>> 09/10/2026 22:48:28 OffScreenWebViewInScrollViewShouldNotCrashOnOverscroll Stop
Passed OffScreenWebViewInScrollViewShouldNotCrashOnOverscroll [46 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue38080.trx
Test Run Successful.
Total tests: 1
Passed: 1
Total time: 1.0372 Minutes
>>> TRX_RESULT_FILE: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue38080.trx
📁 Fix files reverted (6 files)
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Android.cssrc/Core/src/Handlers/View/ViewHandlerOfT.Android.cssrc/Core/src/Handlers/WebView/WebViewHandler.Android.cssrc/Core/src/Platform/Android/MauiHybridWebView.cssrc/Core/src/Platform/Android/MauiWebView.cssrc/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
📋 Pre-Flight — Context & Validation
PR #38181 Pre-Flight
Context
- Checked-out review branch:
pr-review-38181 - Squashed PR commit:
bec4482193c79efaad4ab6a7c30892c51bee4edc - Base:
origin/main - GitHub API metadata was unavailable because
ghis not authenticated; the checked-out squashed commit andgit diff origin/main...HEADare the authoritative inputs. - The PR addresses issue #38080: an Android RenderThread
SIGSEGVinGLFunctorDrawablewhen a hardware-accelerated WebView inside a ScrollView is off-screen and the ScrollView is overscrolled or navigated away from. - Gate result supplied by the caller: PASS. Do not repeat gate verification.
Existing PR Approach
The PR removes the explicit ClipBounds rectangle and auto-sizing latch from both MauiWebView and MauiHybridWebView. It instead makes both Android handlers always use a WrapperView, enables ClipChildren on that wrapper, and relies on native child clipping/HWUI off-screen rejection before Chromium's GL functor is invoked. The added wrapper requires explicit disconnect cleanup and a generic ViewHandler cleanup adjustment. The PR also updates Android handler tests for wrapper-based effective transforms/opacity and adds an Issue38080 UI reproduction.
An alternative candidate must not repeat this mechanism: do not simply remove ClipBounds, force NeedsContainer, or move the same wrapper/ClipChildren logic to another call site.
Changed Files
- Added
src/Controls/tests/TestCases.HostApp/Issues/Issue38080.cs - Added
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cs - Modified
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Android.cs - Modified
src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs - Modified
src/Core/src/Handlers/WebView/WebViewHandler.Android.cs - Modified
src/Core/src/Platform/Android/MauiHybridWebView.cs - Modified
src/Core/src/Platform/Android/MauiWebView.cs - Modified
src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt - Modified
src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBasementOfT.Android.cs - Modified
src/Core/tests/DeviceTests/Handlers/WebView/WebViewHandlerTests.Android.cs
Validation Contract
Primary test:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue38080"After the primary test passes, mandatory regression test:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue36154"A candidate is Pass only if both commands execute successfully. A primary failure is Fail; an unavailable Android device/emulator is Blocked; a regression failure is Fail.
Attempt Bounds
Each candidate gets one implementation/test pass and at most one focused correction/retest. The baseline must be established and restored only through .github/scripts/EstablishBrokenBaseline.ps1 as required by the try-fix skill. Existing unrelated worktree changes are harness-owned and must not be reverted or edited.
🔬 Code Review — Deep Analysis
Expert Evaluation of the Submitted PR
Verdict: LGTM
The single maui-expert-reviewer pass evaluated the raw submitted diff at
bec4482193c79efaad4ab6a7c30892c51bee4edc. It found no actionable issue on
an added or modified line. The required inline findings artifact contains an
empty JSON array.
The review covered the Android WebView and HybridWebView container
lifecycle, always-on WrapperView behavior, child clipping, disconnect and
reconnect cleanup, native WebView ownership and destruction, the generic
Android ViewHandler cleanup adjustment, public API entries, and the added
regression coverage. The trusted Gate result is also positive: the tests fail
without the submitted fix and pass with it.
Because the expert review produced no actionable feedback, there is no
reviewer change to apply. The pr-plus-reviewer candidate should therefore
remain byte-for-byte equivalent to the submitted PR rather than introduce an
unrequested refinement.
🛠️ Try-Fix — Analysis & Comparison
Candidate 1
Approach
Candidate 1 attempted a mechanism-level alternative to PR #38181's wrapper/clip-based fix: leave clipping/container strategy intact and instead suppress Android WebView hardware draw participation while the WebView is off-screen or detached, re-enabling when visible/attached.
Mechanistic difference from existing PR fix
Existing PR mechanism:
- Removes WebView ClipBounds behavior
- Forces wrapping WebView/HybridWebView in WrapperView
- Relies on
ClipChildren=truegeometry clipping for off-screen rejection
Candidate 1 intended mechanism:
- No wrapper/ClipChildren/ClipBounds topology change
- Uses visibility/lifecycle state as the gating signal
- Prevents RenderThread from entering GL functor draw path for non-visible intervals
Result
Blocked (environment precondition)
What happened
- Baseline command run:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 - Baseline failed:
DIRTY WORKING DIRECTORY - Cannot establish baseline - The script raised:
EstablishBrokenBaseline.ps1 failed: Working directory is not clean. Clean up before establishing baseline. .github/.baseline-state.jsonremained absent.
Per try-fix rules, with baseline state absent there is no safe RevertedFiles allow-list; therefore candidate made no tracked code edits and did not run tests.
Files changed
No code files in PR scope were changed.
Candidate diff
(empty)Test execution summary
Primary required command:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue38080"- Outcome: not run (blocked before test phase)
Mandatory regression command (only after passing primary):
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue36154"- Outcome: not run (primary not run/pass)
Self-review summary
- Inline maui-expert self-review findings: 0
- Recorded findings payload:
[]
Restore confirmation
After artifact capture, required restore command executed:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore- Output:
No baseline state found. Nothing to restore. - Result object:
Restored=False,Message="No baseline state found"
This is the expected no-state restore outcome for this blocked attempt.
Candidate 2 (Final)
Approach
Candidate 2 selected software-compositor isolation as a different root-cause hypothesis: the Android Chromium hardware compositor/driver path itself is unsafe for this reproduction. The intended implementation would force the affected native WebView surfaces onto Android software rendering, preventing creation/use of GLFunctorDrawable while retaining the existing view hierarchy, clipping, and normal draw lifecycle.
How this differs mechanistically
- PR fix avoided: The PR removes WebView
ClipBounds, always wraps WebView/HybridWebView inWrapperView, and usesClipChildren=trueso parent geometry rejects off-screen hardware rendering. - Candidate 1 avoided: Candidate 1 planned to gate hardware draw participation using effective visibility and attachment lifecycle state.
- Candidate 2 mechanism: Software rasterization removes the GL functor backend continuously, independent of where the view is clipped and whether it is visible or attached. Overscroll or navigation therefore cannot submit a
GLFunctorDrawable; this neither changes clipping topology nor conditionally suppresses drawing based on lifecycle state.
Result
Blocked
Failure analysis
Baseline establishment failed before any edits were allowed:
- Command:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 - Failure:
ERROR: DIRTY WORKING DIRECTORY - Cannot establish baseline - Exception:
EstablishBrokenBaseline.ps1 failed: Working directory is not clean. Clean up before establishing baseline. - State inspection:
.github/.baseline-state.jsonwas absent.
The dirty paths are pre-existing harness-owned changes under .github and eng. They could not be edited, cleaned, or reverted. Because no baseline state and no RevertedFiles allow-list existed, the skill required Candidate 2 to stop before tracked code edits.
Files changed
No PR target code files were changed.
Complete captured candidate diff
(empty)Test outcomes
Primary:
- Command:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue38080" - Outcome: Not executed — blocked before implementation/testing because baseline establishment failed and no baseline state existed.
Mandatory regression:
- Command:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue36154" - Outcome: Not executed — the contract permits regression execution only after a passing primary execution.
Primary executions used: 0 of 2 maximum. Gate verification was not rerun. No other tests were run.
Self-review
- Inline MAUI expert self-review findings: 0
reviewer-findings.json:[]- With no candidate diff, the review applied the overarching principles and always-active Logic and Correctness, Regression Prevention, and Complexity Reduction dimensions and found no actionable diff finding.
Baseline restore confirmation
The required script-only restore command ran after artifact capture:
- Command:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore - Output:
No baseline state found. Nothing to restore. - Result object:
Restored=False,Message="No baseline state found"
This is the expected no-state restore outcome because baseline establishment failed before edits and .github/.baseline-state.json never existed. No attempt-created code changes remain.
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Winner
pr — the submitted PR fix
The submitted implementation is the only distinct, implemented candidate with
a positive trusted Gate result. The single expert review found no actionable
error, warning, or discussion item, and inline-findings.json is empty.
Comparative Evaluation
| Rank | Candidate | Implementation | Validation | Expert assessment | Decision |
|---|---|---|---|---|---|
| 1 | pr |
Replaces child ClipBounds management with an always-present WrapperView whose native child clipping bounds Android WebView and HybridWebView rendering; includes lifecycle cleanup and regression coverage. |
Gate passed: tests fail without the fix and pass with it. | LGTM, no actionable findings. | Winner. It is implemented, directly addresses the crash mechanism without disabling hardware acceleration, and has positive regression evidence. |
| 2 | pr-plus-reviewer |
Byte-for-byte equivalent to pr; the reviewer produced no refinement to apply, so reviewer.patch is empty. |
No separate run was warranted because no code changed; it inherits the same trusted Gate evidence as pr. |
No additional findings or changes. | Sound but redundant. With no delta or quality improvement, it cannot displace the submitted fix. |
| 3 (tie) | try-fix-1 |
Intended to gate hardware draw participation using effective visibility and attachment state. No implementation or candidate diff was produced. | Blocked before testing because the required baseline could not be established. Primary and regression tests were not run. | No diff existed to evaluate. | Below both validated PR-equivalent candidates because the approach is hypothetical and untested. |
| 3 (tie) | try-fix-2 |
Intended to force software composition and thereby avoid GLFunctorDrawable. No implementation or candidate diff was produced. |
Blocked before testing because the required baseline could not be established. Primary and regression tests were not run. | No diff existed to evaluate. | Below both validated PR-equivalent candidates because the approach is hypothetical, untested, and would trade away hardware composition if implemented. |
Why pr Wins
The raw PR and pr-plus-reviewer have identical product code, behavior, and
evidence. Selecting the raw PR avoids representing an empty reviewer delta as a
necessary change. Both try-fix candidates are blocked sketches with empty diffs
and no primary or regression result, so neither can outrank the implemented
Gate-passing fix.
The trusted Gate permits approval, and the expert review found no blocking
errors or unresolved discussion items. No candidate reported a failed
regression test; the two alternatives were not executed at all.
🔗 Regression Cross-Reference
🔍 Regression Cross-Reference
⚠ Overlaps with prior bug-fix PRs — same files modified, but no exact line revert detected.
| File | Fix PR | Fixed issue(s) |
|---|---|---|
src/Core/src/Platform/Android/MauiWebView.cs |
#36499 | #36154 |
🧪 Regression Tests to Verify
These tests were added by the overlapping fix PRs. Running them to verify no side-effect regressions:
| Fix PR | Type | Test | Filter |
|---|---|---|---|
| #36499 | UITest | Issue36154 | Issue36154 |
🧪 Regression Test Results
✅ PASSED — 1 passed, 0 failed, 0 skipped
| Fix PR | Test | Type | Result |
|---|---|---|---|
| #36499 | Issue36154 | UITest | ✅ PASSED |
📱 UI Tests — ViewBaseTests,WebView
Detected UI test categories: ViewBaseTests,WebView
✅ Deep UI tests — 175 passed, 0 failed, 1 skipped across 2 categories on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
ViewBaseTests |
118/119 (1 skipped) ✓ | — |
WebView |
57/57 ✓ | — |
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs) |
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
Pushed correction and video evidenceThe follow-up fix was pushed in 69784ab24a and d2d3fb054b. Android WebView and HybridWebView now use parent-owned native child clipping through Before: native crash reproducedPre-PR production code reproduced a real RenderThread pr38181-before-native-crash.mp4Original PR: rendering regression reproducedThe original PR revision painted green outside the WebView bounds. pr38181-original-fix-bounds-regression.mp4After: corrected bounds and overscrollpr38181-corrected-webview-validation.mp4Local validation at d2d3fb0:
No visual baselines were changed. The two Hybrid screenshot failures are baseline-matching failures, not passing tests. Scope: these recordings and results cover the pushed correction at |
|
/azp run maui-pr-uitests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Closed in favour of #38467 |
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
…handlers (#38467) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change A WebView-scoped alternative to #38181. `src/Core/src/Handlers/View/ViewHandlerOfT.Android.cs` is **unchanged**. Android can crash in `RenderThread` (`SkSurface::getCanvas` / `SkSurface_Base::getCachedCanvas` and `GLFunctorDrawable::onDraw`) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removing `ClipBounds` loses the bounded-rendering protection. - Give Android WebView and HybridWebView a native clipping `WrapperView`, and remove their explicit `ClipBounds` management. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects. - Keep disconnect cleanup local to these two handlers. Their `RemoveContainer` overrides use the nullable non-generic platform-view getter because disconnect clears the backing field first. Detach and clear the wrapper so reconnect does not retain the old native view. - Extend WebView lifecycle coverage and add HybridWebView disconnect/reconnect coverage. Shared **test-only** transform/opacity probes now observe the effective wrapped native view; no general-purpose production handler changes. - Add a real overscroll/back-navigation UI regression with local HTML, positive native dimensions, attachment/hardware-rendering checks, midpoint visibility, and touch gestures at both scroll extremes. It does not assert the chosen clipping implementation to manufacture a baseline failure. ### Comparison with #38181 This retains the native-parent-clipping approach but avoids its generic Android `ViewHandler` change. Cleanup is confined to the affected handlers. The new UI scenario uses deterministic positioning followed by physical overscroll gestures instead of relying on long fling traversal to find the WebView. The tradeoff is one wrapper for each Android WebView/HybridWebView, even without an explicit shadow or clip. Outline clipping still reproduced the native crash. Forcing a hardware layer survived one experimental run but is not used: that is insufficient evidence and adds offscreen-layer costs. Removing clipping without replacement is not acceptable because it permits drawing outside the WebView slot. ### Local validation | Scenario | Observed result | | --- | --- | | Latest stable package checked, **10.0.101**, Android 16/API36 | Native SIGSEGV reproduced; recorded with matching native stack | | Package **10.0.60** control | Same reproduction sequence survived | | Unmodified source `bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d`, API33 | Both new UI cases failed with a real native RenderThread crash | | Fixed source, same API33 device | Both new UI cases passed; recorded repeated top/bottom overscroll and successful back navigation | | Fixed source, API30 and API36 | Both new crash cases passed on each; focused JavaScript/auto-sizing guards also passed on API33/API36 | | Core WebView device category, API30 | **77 passed, 3 skipped**, including destroy/reconnect, transforms and opacity | | Controls HybridWebView device category, API33 | **93 passed, 5 skipped**, including new wrapper disconnect/reconnect guard | | Existing API30 visual guards | WebView background/bounds and WebView shadow comparisons passed with **unchanged baselines** | **Baseline-only local discrepancy:** `VerifyHybridWebViewWithShadow` differs from its API30 screenshot by **12.40% on both unmodified `main` and this fix**, with the same HTML vertical offset. This was reproduced in a paired base/fixed run, not dismissed as flaky. No visual baselines or tolerances were changed. The same shadow test **passes in CI on both Android runtimes**. API36 local visual baselines are missing or size-incompatible for these guards, so API30 was used for local unchanged-baseline comparisons. ### Azure CI evidence Requested with [`/azp run`](#38467 (comment)), against head `2306c38910944c2c2a7926cfaf38cd1dbee40ab0` (tested merge `5c88e55bc549d319d21b67b4c6798d9f9e1b8de8`). All three pipelines and the targeted diagnostic retries have finished. Retries reran only failed/canceled jobs at the same revision; no code, baseline, or tolerance changes were used to obtain recovery. **Both Android UI WebView legs passed all 59 tests**, including both new Issue38080 cases, all three Issue35771 guards, WebView background/bounds, WebView and HybridWebView shadows, HTML JavaScript evaluation, and changing the HybridWebView root: | Runtime | Actual result | Evidence | | --- | --- | --- | | Android CoreCLR | **59/59 passed** | [Test run 43990890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43990890&_a=runCharts), [task log 3177](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3177?api-version=7.1) | | Android Mono | **59/59 passed** | [Test run 43991136](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43991136&_a=runCharts), [task log 3523](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/3523?api-version=7.1) | Helix XML from [device build 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) also confirms **`DisconnectHandlerDestroysNativeWebView` and `DisconnectHandlerRemovesClippingContainer` passed on both Android Mono and CoreCLR**. These are actual test outcomes, not inferred from XHarness exit codes or job colors. | Pipeline | Final outcome | | --- | --- | | [maui-pr 1593769](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593769) | **Succeeded**, including both integration jobs; Windows Debug recovered on its targeted retry | | [maui-pr-devicetests 1593772](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593772) | Failed only on the baseline Android Mono image test; MacCatalyst retry recovered | | [maui-pr-uitests 1593771](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593771) | Failed on baseline Android tests and a WinUI diagnostic snapshot difference; the macOS Shell retry **passed with complete results** | **macOS Shell coverage gap closed:** outer attempt 2 [run 44013082](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=44013082&_a=runCharts) completed **336 total / 323 passed / 13 skipped / 0 failed**. `ShellTitleViewWithXNameShouldNotLeakMemory` passed (result 100205). [Test-task log 4348](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4348?api-version=7.1) ends `Test Run Successful`, with one final TRX and no internal retry; [job log 4358](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593771/logs/4358?api-version=7.1) confirms success. The earlier canceled attempt is historical, not the current outcome. **Other same-revision recoveries:** Windows Debug's file lock ([log 1005](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1593769/logs/1005?api-version=7.1)); CoreCLR `RadioButtonShouldNotLeakMemory` ([run 43994890](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994890&_a=runCharts), result 100026); and MacCatalyst device test `CarouselView Does Not Leak With Default ItemsLayout` on both OS targets ([run 43992584](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992584&_a=runCharts), result 100674, and [run 43992586](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992586&_a=runCharts), result 100879, corroborated by both Helix XMLs). **Remaining baseline failures:** Android Mono/CoreCLR `DisplayAlertAsyncShouldNotCrashWhenPageUnloaded` has the same timeout and `Issue33287.cs:23` stack on [main build 1593073](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593073). SafeArea retry [run 43994128](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43994128&_a=runCharts) passed the original Issue32941 test but failed `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device test `ImageWithUndefinedSizeAndWithBackgroundSetRenders` also fails on [main build 1593627](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1593627). Its [Helix job](https://helix.dot.net/api/2019-06-17/jobs/21f5cedc-117d-4855-a27a-c247d680db4d/workitems) is complete: all work items finished, and Controls XML reports **994 total / 981 passed / 1 failed / 12 skipped / 0 errors**. **Remaining WinUI snapshot failure:** `VerifyShellSearch_TextColor` reproduced a **0.76%** visual difference on two workers: [original run 43992914](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43992914&_a=runCharts), result 100333, and [retry run 43996220](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=43996220&_a=runCharts), result 100330. Inspection of all five retry captures shows that **the red query-text pixels match the baseline exactly**. The entire image interior matches after excluding the diagnostic `FocusStatus` label (actual blank, baseline `Focused`) and a one-pixel outer border. Those exclusions were for analysis only; the test, baseline, and tolerance remain unchanged. The existing stateful fixture resets that diagnostic label and repopulates it from focus events. The precise event sequence is not established, so this test is still recorded as failed, not dismissed as a proven current-baseline match. No execution path from the Android-only functional changes to this unchanged Windows feature page was identified. The [final-attempt reconciliation](#38467 (comment)) also confirms that `SafeAreaPerEdgeValidation`, `LayoutShouldBeCorrectOnFirstNavigation`, `PickPhotosAsyncShouldReturnFromChildActivity`, `Bugzilla57910Test`, and `RadioButtonShouldNotLeakMemory` passed in their final TRX files; superseded/transient failures are not current failures. **No requested Android WebView/HybridWebView regression was observed. Overall CI is not entirely green, and this PR remains a draft rather than receiving a blanket regression-free or merge-readiness claim.** Unrelated controls, visual baselines, tolerances, and generic production handlers were not changed to manufacture green CI. ### Before / after evidence **Before: MAUI 10.0.101 (latest stable checked), API36.** The fixed-height WebView is rendered, then the app crashes during the scrolling reproduction. The captured native stack includes `SkSurface::getCanvas` and `GLFunctorDrawable::onDraw`. https://github.com/user-attachments/assets/ebd5e1cc-2872-4bbf-8970-180b287c8eee **After: this source fix, API33.** The same API33 environment also reproduced the crash on unmodified source. This recording shows loaded hardware-accelerated HTML, repeated physical overscroll at both extremes, and successful Android back navigation with the process still alive. The blue content occupies the measured WebView slot rather than painting outside it. https://github.com/user-attachments/assets/fce869ab-9cb4-4586-85a8-212c5b5c6020 | Latest package reproduction | Fixed source: bounded HTML and native diagnostics | | --- | --- | | <img src="https://github.com/user-attachments/assets/cd9b92e9-b11b-45f2-be6d-6159685d7605" width="280" alt="MAUI 10.0.101 reproduction before the crash" /> | <img src="https://github.com/user-attachments/assets/fc84acb9-9f64-48ff-9288-716cd502079a" width="280" alt="Fixed source showing loaded hardware-accelerated WebView content inside its bounds" /> | ### Issues Fixed Fixes #38080 Related regression guards: #35771, #34518 and #28714.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Use Android's native parent-owned child clipping for
WebViewandHybridWebView, instead of maintaining an explicitClipBoundsrectangle on each native WebView.The reported scenario places a fixed-height WebView between two long groups of rows in a ScrollView. The WebView is off-screen at both scroll extremes; overscroll or back navigation can crash the Android RenderThread in
GLFunctorDrawable. The reporter observed the regression between MAUI 10.0.60 and 10.0.100.Why simply clearing ClipBounds is insufficient
The original version of this PR cleared the clip after layout. Its new overscroll test passed in CI, but the existing
WebViewBackgroundColorShouldBeAppliedtest failed on both Android Mono and CoreCLR: the WebView painted green outside its allocated bounds. The visual baseline must not be changed to accept that overflow.MAUI layout parents allow children to draw outside their bounds. An explicit WebView
ClipBoundsrectangle constrains rendering, but it does not enable the same native off-screen rejection as Android's parentclipChildrenpolicy.Fix
WebViewHandlerandHybridWebViewHandleralways use the existing MAUIWrapperViewand enableSetClipChildren(true)on that wrapper.clipToBoundsflag. Android HWUI uses that flag to reject fully off-screen nodes before replaying their drawing commands.The tradeoff is one native wrapper per Android WebView. Existing wrapper-based shadows and custom clips remain on the wrapper; the child WebView is bounded independently.
This does not disable Chromium's hardware-accelerated compositor. The distinction is native bounds clipping and off-screen rejection, not selecting or disabling the GL-functor renderer.
Tests and empirical evidence
Issue38080now loads the HTML and visits the WebView midpoint before reaching and overscrolling both extremes and navigating back. It also checks positive native size, attachment, hardware acceleration, and parent child-clipping.WebViewBackgroundColorShouldBeAppliedguards against drawing beyond the allocated WebView bounds; its visual baseline is unchanged.DisconnectHandlerDestroysNativeWebViewattaches the actual container and verifies cleanup and recreation on reconnect.Before/after recordings, detailed results, and limitations: the original native SIGSEGV and the original PR's green overflow were both reproduced. The correction passed all 5 targeted UI tests and 77 Core WebView tests (3 skipped). Two HybridWebView screenshot tests also fail unchanged on pre-PR production code in the tested environment; no baselines were updated. These local results do not replace fresh CI for the pushed commits.
Native implementation references
Issues Fixed
Fixes #38080.
Preserves the bounds-rendering behavior covered by #34518 and addresses the explicit WebView clipping mechanism involved in #31475 and #35771.