Repository navigation
[Android] Fix off-screen WebView crash without changing generic view handlers - #38467
Conversation
<!-- 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 Adds `10.0.110` to both version dropdowns in the bug report issue template: - Version with bug - Last version that worked well This keeps the dropdowns consistent for the .NET 10 SR11 release.
<!-- 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 Adds `11.0.0-rc.1` to both version dropdowns in the bug report issue template: - Version with bug - Last version that worked well This keeps the dropdowns current for the .NET 11 RC1 release. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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! ## Summary Advance `main` to the .NET 10 SR12 development cycle now that `release/10.0.1xx-sr11` has been cut from the merge of #37393 (`e047434fd22752a3e96187d55cd554a4a1c200b5`). Change only `PatchVersion` in `eng/Versions.props` from `110` to `120`. Keep `SdkBandVersion=10.0.100`, `PreReleaseVersionLabel=ci.main` (including the inflight override), and `StabilizePackageVersion=false` unchanged. This is separate from the SR11 servicing-flip PR and does not change the release branch. Related: #38210. ## Validation - Evaluated `eng/Versions.props` using `dotnet msbuild -getProperty`: version `10.0.120`, SDK band `10.0.100`, prerelease label `ci.main`, stable versions disabled. - Ran the repository formatter scoped to `eng/Versions.props` and confirmed the final diff is exactly one changed line.
Use native parent clipping instead of explicit WebView ClipBounds, preserving bounded rendering. Keep nullable disconnect cleanup in the WebView and HybridWebView handlers rather than changing the generic Android view handler. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b0d2291a-f64b-42b5-9044-25342d895d3c
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38467Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38467" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
Test Failure Review: Needs human investigation - click to expandOverall verdict: Needs human investigation No extracted failure is currently proven related to the changed Android WebView/HybridWebView handlers or the new Issue38080 coverage. Both Android WebView UI legs passed, the other WebView UI legs passed, and the main Coverage: 169 checks · 159 passing · 10 failing/aborted · 0 pending · 0 inaccessible · 2 unmapped · 15 unexplained build legs · 0 unaccounted failing checks · 1 aborted failing check · 0 canceled-build checks · 7 device-test unverified · 18 unattributed · 0 regressed-vs-base · 1 demoted by ci-scan. Deterministic ceiling: Needs human investigation — Build Analysis/Build Insights lack inspectable AzDO evidence; 15 failed legs have no extractable failure; the macOS Shell check was cancelled; and seven green device-test checks could not be positively confirmed because of the XHarness exit-0 behavior.
Recommended actionDo not change the WebView implementation based on the current failures. Inspect the incomplete Android Mono Helix work item, the cancelled macOS Shell check, and the unexplained failed legs; rerun those checks if their logs do not expose a deterministic cause. Evidence details
|
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@kubaflo — new AI review results are available based on commit
2306c38.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: ANDROID · Base: main · Merge base: 3823473d
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 HybridWebViewTests_Initialization (DisconnectHandlerRemovesClippingContainer) Category=HybridWebView |
✅ FAIL — 585s | ✅ PASS — 411s |
📱 WebViewHandlerTests (DisconnectHandlerDestroysNativeWebView) Category=WebView |
✅ FAIL — 408s | ✅ PASS — 382s |
🖥️ Issue38080 Issue38080 |
🛠️ BUILD ERROR | 🛠️ BUILD ERROR |
🔴 Without fix — 📱 HybridWebViewTests_Initialization (DisconnectHandlerRemovesClippingContainer): FAIL ✅ · 585s
(no coded error found; showing last 1200 chars)
moryBytes": 8322990080
},
"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.controls.devicetests'..
info: Successfully uninstalled com.microsoft.maui.controls.devicetests
XHarness exit code: 1 (TESTS_FAILED)
Passed: 0
Failed: 1
Skipped: 0
Total: 1
Tests completed with exit code: 1
🟢 With fix — 📱 HybridWebViewTests_Initialization (DisconnectHandlerRemovesClippingContainer): PASS ✅ · 411s
(no coded error found; showing last 1200 chars)
"totalMemoryBytes": 8322990080
},
"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.controls.devicetests'..
info: Successfully uninstalled com.microsoft.maui.controls.devicetests
XHarness exit code: 0
Passed: 1
Failed: 0
Skipped: 0
Total: 1
Tests completed successfully
🔴 Without fix — 📱 WebViewHandlerTests (DisconnectHandlerDestroysNativeWebView): FAIL ✅ · 408s
(no coded error found; showing last 1200 chars)
"totalMemoryBytes": 8322990080
},
"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)
433000,
"totalMemoryBytes": 8322990080
},
"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: 🛠️ BUILD ERROR · 603s
Error-relevant lines (filtered from the build log):
/home/vsts/work/1/s/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue35889.cs(17,14): error MAUI0003: Test method 'EmptyCollectionViewCollapsesAndExpandsWithItems' uses the sharded category 'CollectionView' directly; use `[ShardedTestCategory(UITestCategories.CollectionView, shard: ...)]` so both the umbrella and CI shard categories are registered [/home/vsts/work/1/s/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj]
/home/vsts/work/1/s/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34271.cs(15,14): error MAUI0003: Test method 'CollectionViewScrollPositionPreservedAfterPickerDismiss' uses the sharded category 'CollectionView' directly; use `[ShardedTestCategory(UITestCategories.CollectionView, shard: ...)]` so both the umbrella and CI shard categories are registered [/home/vsts/work/1/s/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj]
🟢 With fix — 🖥️ Issue38080: 🛠️ BUILD ERROR · 589s
Error-relevant lines (filtered from the build log):
/home/vsts/work/1/s/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue35889.cs(17,14): error MAUI0003: Test method 'EmptyCollectionViewCollapsesAndExpandsWithItems' uses the sharded category 'CollectionView' directly; use `[ShardedTestCategory(UITestCategories.CollectionView, shard: ...)]` so both the umbrella and CI shard categories are registered [/home/vsts/work/1/s/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj]
/home/vsts/work/1/s/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34271.cs(15,14): error MAUI0003: Test method 'CollectionViewScrollPositionPreservedAfterPickerDismiss' uses the sharded category 'CollectionView' directly; use `[ShardedTestCategory(UITestCategories.CollectionView, shard: ...)]` so both the umbrella and CI shard categories are registered [/home/vsts/work/1/s/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj]
⚠️ Failure Details
- 🛠️ Issue38080 without fix: build failed before tests could run
/home/vsts/work/1/s/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue35889.cs(17,14): error MAUI0003: Test method 'EmptyCollectionViewCollapsesAndExpandsWithItems' uses the sharded category...
- 🛠️ Issue38080 with fix: build failed (fix does not compile)
/home/vsts/work/1/s/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue35889.cs(17,14): error MAUI0003: Test method 'EmptyCollectionViewCollapsesAndExpandsWithItems' uses the sharded category...
📁 Fix files reverted (5 files)
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.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 #38467 Pre-Flight
Scope
- PR:
[Android] Fix off-screen WebView crash without changing generic view handlers - Issue: #38080, an Android regression in 10.0.100 where overscrolling a
ScrollViewwhile its fixed-heightWebViewis off-screen, or navigating back from that page, can terminate the process with a RenderThread SIGSEGV inGLFunctorDrawable/Skia. The reported software-layer workaround avoids the crash but is not an acceptable framework fix. - Base/head:
mainat local merge base3823473d7d581aed7a51a9ab3d56973e12b4d1dc; materialized review headf4bc2bb5c350c66052e59442db7e2ee7dab11313for upstream PR head2306c38910944c2c2a7926cfaf38cd1dbee40ab0. - Gate: Already passed: the primary tests fail without the PR fix and pass with it. Do not rerun gate verification.
Existing PR approach
The PR removes explicit ClipBounds state and OnSizeChanged/attach-time clip updates from MauiWebView and MauiHybridWebView. Both Android handlers instead always require a WrapperView, enable native parent ClipChildren, and perform handler-local wrapper teardown/reconnect cleanup. This moves clipping from the hardware-accelerated WebView itself to its native parent so Android can reject off-screen drawing without presenting RenderThread with an empty WebView/Skia clip.
The PR deliberately avoids the generic ViewHandler change proposed by #38181. It also updates Android handler tests to observe the effective wrapped platform view and adds WebView/HybridWebView disconnect/reconnect coverage.
Diff inspected
Production changes:
src/Core/src/Handlers/WebView/WebViewHandler.Android.cssrc/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Android.cssrc/Core/src/Platform/Android/MauiWebView.cssrc/Core/src/Platform/Android/MauiHybridWebView.cssrc/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
Test changes:
src/Controls/tests/TestCases.HostApp/Issues/Issue38080.cssrc/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cssrc/Controls/tests/DeviceTests/Elements/HybridWebView/HybridWebViewTests_Initialization.Android.cssrc/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBasementOfT.Android.cssrc/Core/tests/DeviceTests/Handlers/WebView/WebViewHandlerTests.Android.cs
The three new test files are additions in the PR. Each try-fix attempt must honor .github/.baseline-state.json; if EstablishBrokenBaseline.ps1 reports added fix files in NewFiles, the try-fix skill requires a truthful Blocked result rather than edits outside its restoration boundary.
Bounded candidate validation
- Primary test:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue38080" - Mandatory regression after the primary test passes:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue36154" - A regression failure makes the candidate
Fail. - One implementation/test pass and at most one focused correction/retest per candidate.
- No gate rerun and no full test suite.
Candidate constraints
Each candidate must use a different root-cause hypothesis from the current wrapper-clipping fix. Candidate 2 must also avoid candidate 1's mechanism and incorporate candidate 1's recorded outcome without reopening or rerunning it. Android, handler lifecycle, threading, and public API instructions apply to the touched production paths.
🔬 Code Review — Deep Analysis
Expert PR Evaluation
Review source: Submitted PR range 3823473d7d..f4bc2bb5c3
Verdict: LGTM
Confidence: Medium — the change is localized to Android platform-handler plumbing, and the trusted Gate passed.
Independent Assessment
The PR replaces per-WebView/HybridWebView ClipBounds bookkeeping with an always-present Android WrapperView. The wrapper clips its native child, so Android can cull an off-screen WebView at the parent boundary without asking RenderThread to draw through an empty WebView clip. The change is scoped to the two WebView handlers rather than the generic Android ViewHandler.
The lifecycle implementation is coherent:
NeedsContainercreates the wrapper for every Android WebView and HybridWebView.SetupContainerpreserves the normal wrapper setup and explicitly enables child clipping.DisconnectHandlerfirst detaches the wrapper, then clearsHasContainer.- The handler-specific
RemoveContainerintentionally reads the nullable non-genericViewHandler.PlatformView, becauseIElementHandler.DisconnectHandlerclears the generic platform-view property before invoking the handler callback.WrapperView.RemoveContainersafely takes its cleanup path when that value is null, removes all wrapper children, and clearsContainerView. - Reconnection creates a new platform view and wrapper; the added device tests cover cleanup, repeated disconnect, and reconnect.
The test-only transform, rotation, scale, and opacity probes now observe the effective ToPlatform() view, which is the wrapper when a container exists. The UI regression uses local HTML, verifies positive native dimensions/attachment/hardware acceleration, exercises both overscroll orders, and confirms navigation back from the repro page.
Findings
No actionable file:line findings. inline-findings.json contains [].
Blast Radius and Failure-Mode Probing
- All instances: Every Android WebView and HybridWebView receives one wrapper. This is intentional to make parent clipping reliable even when no shadow or explicit MAUI clip is configured.
- Startup/static state: No new startup path or static/shared mutable state is introduced.
- Disconnect/reconnect: Cleanup remains idempotent after the platform-view reference is cleared, and tests cover reconnect plus a second disconnect call.
- Null/default state: The wrapper helpers explicitly tolerate null context, platform view, and container during lifecycle transitions.
- Cross-platform scope: Production behavior is Android-only; the issue UI test is likewise Android-scoped.
External Output Contract: Not applicable.
Reviewer Refinement Decision
The single MAUI expert-review pass found no actionable feedback, so there is no justified source refinement. The pr-plus-reviewer candidate should remain behaviorally and textually identical to the submitted PR.
🛠️ Try-Fix — Analysis & Comparison
Try-Fix Candidate 1 Narrative (PR #38467)
Attempt Artifact Directory
CustomAgentLogsTmp/PRState/38467/PRAgent/try-fix/attempt-1
Approach Description
Planned a viewport-gated draw suppression fix in Android MauiWebView/MauiHybridWebView: suppress WebView draw participation when fully non-visible/off-window, restore when visible.
Mechanism-Level Difference vs Current/Prior Fixes
- Current PR / #38181 mechanism: wrapper-parent clipping (
WrapperView+ClipChildren=true) to rely on clipping boundaries. - Candidate 1 mechanism: lifecycle/visibility-gated draw submission to prevent GL functor draw from being submitted while non-visible, avoiding clip-bound paths entirely.
Execution Outcome
Blocked before implementation because baseline establishment failed.
Baseline Status
pwsh .github/scripts/EstablishBrokenBaseline.ps1 reported dirty working directory and aborted baseline creation. .github/.baseline-state.json was absent after run.
Because try-fix mandates baseline allow-list enforcement and explicit block when baseline state is absent, no production edits were made.
Captured Diff
Explicitly empty diff for this candidate attempt (no tracked file edits were performed).
Test Outcomes
- Primary:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue38080"— Not run (Blocked precondition) - Regression:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue36154"— Not run (primary did not run)
Result
Blocked
Self-Review
- Inline maui-expert self-review artifacts created.
reviewer-findings.jsonfindings count: 0.
Failure / Blocker Analysis
The try-fix workflow requires EstablishBrokenBaseline.ps1 success and .github/.baseline-state.json generation before editing any tracked files. That prerequisite failed due pre-existing dirty state in harness-owned files, so the attempt was correctly terminated as Blocked without edits/tests.
Try-Fix Candidate 2 Narrative (PR #38467)
Attempt Artifact Directory
CustomAgentLogsTmp/PRState/38467/PRAgent/try-fix/attempt-2
Approach Description
Planned a dedicated Android hardware-layer isolation fix: explicitly place MauiWebView and MauiHybridWebView in LayerType.Hardware, retaining hardware acceleration while isolating each WebView's functor in its own GPU-composited layer.
Mechanism-Level Difference vs Current/Prior Fixes and Candidate 1
- Current PR / #38181: native-parent
WrapperViewclipping (ClipChildren=true) replaces direct WebViewClipBounds; outline clipping also changes clip geometry. - Candidate 1: planned visibility/viewport-gated suppression of draw submission for off-screen/off-window WebViews. It made no code changes and ran no tests because its baseline failed.
- Candidate 2: hypothesizes that direct replay of a live WebView GL functor into the ScrollView render tree races overscroll or detach/back-navigation render-tree mutation. A dedicated hardware layer would cache/composite through a separate GPU layer, so the parent consumes a layer texture rather than replaying the live functor against changing render state. It neither clips/wraps the view nor conditionally suppresses drawing.
Execution Outcome
Blocked before implementation because baseline establishment failed.
Baseline Status
pwsh .github/scripts/EstablishBrokenBaseline.ps1 rejected the pre-existing dirty harness worktree. Its full output is in attempt-2/baseline.log. The log had no Baseline established marker, and .github/.baseline-state.json was absent.
The try-fix skill requires that state file to define the exact RevertedFiles allow-list. Its absence required an immediate Blocked result without tracked-file edits.
Captured Diff
Explicitly empty candidate diff. No production or test files were edited.
Test Outcomes
- Primary:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue38080"— Not run (Blocked before implementation because baseline state was absent) - Mandatory regression:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue36154"— Not run (primary did not run/pass)
Result
Blocked
Self-Review
- Inline MAUI expert self-review performed against the empty candidate diff.
- Applied all overarching principles and the always-active Logic and Correctness, Regression Prevention, and Complexity Reduction dimensions.
reviewer-findings.jsonfindings count: 0.
Failure / Blocker Analysis
The dirty files are pre-existing review-harness changes and must be preserved. The user and skill prohibit checkout/restore/reset/clean/stash and prohibit cleaning or committing harness changes to bypass the guard. With no baseline state, there was no safe modification/restoration boundary; therefore implementation and both device test commands were correctly skipped. The proposed hardware-layer mechanism remains unvalidated, including its GPU memory/performance implications.
🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Winner: pr
The submitted PR is the only implemented candidate and is the strongest available fix. It directly replaces crash-prone WebView ClipBounds updates with handler-scoped native parent clipping, preserves bounded rendering, avoids changing the generic Android ViewHandler, and includes focused disconnect/reconnect plus real overscroll/back-navigation coverage. The trusted Gate passed, and the single MAUI expert review found no actionable code issue.
Approval is not yet justified because the recorded regression cross-reference run reports Issue36154 as FAILED. That test protects WebView gestures inside SwipeView, a directly adjacent behavior in MauiWebView.cs. The available artifact contains no failure log with which to classify the result as product-caused or environmental. The same unresolved result applies to pr-plus-reviewer because that candidate has no source delta from the PR.
Candidate Comparison
| Rank | Candidate | Implementation | Primary/Gate evidence | Mandatory regression evidence | Expert assessment | Result |
|---|---|---|---|---|---|---|
| 1 | pr |
Complete wrapper-parent-clipping fix, scoped to WebView and HybridWebView handlers | Trusted Gate passed: both focused lifecycle tests failed without the fix and passed with it; the Issue38080 Gate build was blocked by unrelated pre-existing MAUI0003 errors | Issue36154: FAILED, with no diagnostic log retained |
No actionable findings; medium confidence due Android handler blast radius | Winner, but hold for regression classification |
| 2 | pr-plus-reviewer |
Byte-for-byte identical to pr; reviewer.patch is empty |
Inherits the same trusted Gate result because there is no source delta | Inherits the same unresolved Issue36154 failure |
No reviewer refinement was warranted | Equivalent behavior, no advantage over the submitted PR |
| 3 | try-fix-1 |
Planned viewport-gated draw suppression; no diff produced | Not run | Not run | Self-review covered an empty diff only | Blocked before implementation because baseline state was unavailable |
| 4 | try-fix-2 |
Planned dedicated hardware-layer isolation; no diff produced | Not run | Not run | Self-review covered an empty diff only | Blocked before implementation; GPU memory/performance and correctness remain unvalidated |
No candidate passed the mandatory Issue36154 regression in the recorded STEP 5a evidence. The two blocked try-fix proposals cannot outrank an implemented, Gate-passing fix, but they also cannot supply evidence that resolves the submitted PR's regression result.
Why pr Wins
- It is the only substantive implementation with empirical fail-without/pass-with evidence.
- Its abstraction boundary is narrower than #38181: generic Android view handlers remain unchanged.
- Its lifecycle cleanup is explicitly adapted to the platform-view-null-before-disconnect contract and is covered across reconnect and repeated disconnect.
pr-plus-revieweradds nothing, while both try-fix candidates are hypotheses without code or validation.
Required Resolution
Classify the recorded Issue36154 failure from a retained focused log, or obtain a passing focused run in a clean environment. If it is proven unrelated or passes, the raw PR remains the recommended implementation; no reviewer patch is needed.
🔗 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
❌ FAILED — 0 passed, 1 failed, 0 skipped
| Fix PR | Test | Type | Result |
|---|---|---|---|
| #36499 | Issue36154 | UITest | ❌ FAILED |
📱 UI Tests — ViewBaseTests,WebView
Detected UI test categories: ViewBaseTests,WebView
ViewBaseTests, WebView) exceeded the per-category time budget (a very long-running category or a slow build/deploy) and was stopped before finishing. This is an infrastructure/timeout issue, not a code problem; re-run the review, and if a category consistently needs more time the per-category budget can be raised (DEEP_UITEST_CATEGORY_CAP_MIN / DEEP_UITEST_HARDSTOP_MIN). See the build-output.log in the drop-deep-uitests artifact.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
|
CI follow-up for
The Android WebView/HybridWebView results documented above remain green. This is a clarification of the evidence, not a blanket CI-clearance claim. |
|
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.
🔵 Needs a closer look
The Android handler and lifecycle changes are substantial, and overall CI still has baseline failures requiring human review.
Pull request overview
Fixes an Android WebView RenderThread crash by using clipped native wrappers for WebView and HybridWebView without changing generic view handlers.
Changes:
- Adds wrapper clipping and reconnect-safe lifecycle cleanup.
- Adds device and UI regression coverage.
- Updates Android API metadata, versioning, and bug-report options.
File summaries
| File | Description |
|---|---|
src/Core/tests/DeviceTests/Handlers/WebView/WebViewHandlerTests.Android.cs |
Adds WebView clipping and lifecycle tests. |
src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBasementOfT.Android.cs |
Updates wrapper-aware test probes. |
src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt |
Records new handler overrides. |
src/Core/src/Platform/Android/MauiWebView.cs |
Removes explicit clipping management. |
src/Core/src/Platform/Android/MauiHybridWebView.cs |
Removes explicit clipping management. |
src/Core/src/Handlers/WebView/WebViewHandler.Android.cs |
Adds wrapper setup and cleanup. |
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Android.cs |
Adds wrapper setup and cleanup. |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cs |
Adds overscroll and back-navigation regression coverage. |
src/Controls/tests/TestCases.HostApp/Issues/Issue38080.cs |
Adds the crash reproduction page. |
src/Controls/tests/DeviceTests/Elements/HybridWebView/HybridWebViewTests_Initialization.Android.cs |
Adds HybridWebView reconnect coverage. |
eng/Versions.props |
Advances the patch version. |
.github/ISSUE_TEMPLATE/bug-report.yml |
Updates supported version options. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 0
- Review effort level: Lite
…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
A WebView-scoped alternative to #38181.
src/Core/src/Handlers/View/ViewHandlerOfT.Android.csis unchanged.Android can crash in
RenderThread(SkSurface::getCanvas/SkSurface_Base::getCachedCanvasandGLFunctorDrawable::onDraw) when an explicitly clipped, fixed-height WebView is off-screen inside a ScrollView. Simply removingClipBoundsloses the bounded-rendering protection.WrapperView, and remove their explicitClipBoundsmanagement. Parent clipping lets Android reject off-screen WebView drawing while retaining bounds and wrapper visual effects.RemoveContaineroverrides 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.Comparison with #38181
This retains the native-parent-clipping approach but avoids its generic Android
ViewHandlerchange. 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
bc3095fafb4f15fa47fc7bb7ae5ad3806b32ee9d, API33Baseline-only local discrepancy:
VerifyHybridWebViewWithShadowdiffers from its API30 screenshot by 12.40% on both unmodifiedmainand 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, against head2306c38910944c2c2a7926cfaf38cd1dbee40ab0(tested merge5c88e55bc549d319d21b67b4c6798d9f9e1b8de8). 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:
Helix XML from device build 1593772 also confirms
DisconnectHandlerDestroysNativeWebViewandDisconnectHandlerRemovesClippingContainerpassed on both Android Mono and CoreCLR. These are actual test outcomes, not inferred from XHarness exit codes or job colors.macOS Shell coverage gap closed: outer attempt 2 run 44013082 completed 336 total / 323 passed / 13 skipped / 0 failed.
ShellTitleViewWithXNameShouldNotLeakMemorypassed (result 100205). Test-task log 4348 endsTest Run Successful, with one final TRX and no internal retry; job log 4358 confirms success. The earlier canceled attempt is historical, not the current outcome.Other same-revision recoveries: Windows Debug's file lock (log 1005); CoreCLR
RadioButtonShouldNotLeakMemory(run 43994890, result 100026); and MacCatalyst device testCarouselView Does Not Leak With Default ItemsLayouton both OS targets (run 43992584, result 100674, and run 43992586, result 100879, corroborated by both Helix XMLs).Remaining baseline failures: Android Mono/CoreCLR
DisplayAlertAsyncShouldNotCrashWhenPageUnloadedhas the same timeout andIssue33287.cs:23stack on main build 1593073. SafeArea retry run 43994128 passed the original Issue32941 test but failedSafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeTogglewith the same Issue28986 assertion as main builds 1593626 and 1593073. Android Mono device testImageWithUndefinedSizeAndWithBackgroundSetRendersalso fails on main build 1593627. Its Helix job 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_TextColorreproduced a 0.76% visual difference on two workers: original run 43992914, result 100333, and retry run 43996220, 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 diagnosticFocusStatuslabel (actual blank, baselineFocused) 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 also confirms that
SafeAreaPerEdgeValidation,LayoutShouldBeCorrectOnFirstNavigation,PickPhotosAsyncShouldReturnFromChildActivity,Bugzilla57910Test, andRadioButtonShouldNotLeakMemorypassed 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::getCanvasandGLFunctorDrawable::onDraw.before-maui-10.0.101.mp4
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.
after-source-fix.mp4
Issues Fixed
Fixes #38080
Related regression guards: #35771, #34518 and #28714.