Skip to content

[Android] Fix off-screen WebView crash without changing generic view handlers - #38467

Merged
kubaflo merged 4 commits into
inflight/currentfrom
kubaflo-android-webview-crash
Sep 13, 2026
Merged

kubaflo merged 4 commits into
inflight/currentfrom
kubaflo-android-webview-crash

Conversation

@kubaflo

@kubaflo kubaflo commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

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.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, 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, task log 3177
Android Mono 59/59 passed Test run 43991136, task log 3523

Helix XML from device build 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 Succeeded, including both integration jobs; Windows Debug recovered on its targeted retry
maui-pr-devicetests 1593772 Failed only on the baseline Android Mono image test; MacCatalyst retry recovered
maui-pr-uitests 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 completed 336 total / 323 passed / 13 skipped / 0 failed. ShellTitleViewWithXNameShouldNotLeakMemory passed (result 100205). Test-task log 4348 ends Test 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 test CarouselView Does Not Leak With Default ItemsLayout on both OS targets (run 43992584, result 100674, and run 43992586, 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. SafeArea retry run 43994128 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. 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_TextColor reproduced 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 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 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.

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
Latest package reproduction Fixed source: bounded HTML and native diagnostics
MAUI 10.0.101 reproduction before the crash Fixed source showing loaded hardware-accelerated WebView content inside its bounds

Issues Fixed

Fixes #38080

Related regression guards: #35771, #34518 and #28714.

kubaflo and others added 4 commits September 11, 2026 20:13
<!-- 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
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38467

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38467"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo

kubaflo commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Sep 12, 2026
@kubaflo

kubaflo commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

Tests Failure Analysis

@kubaflo — test-failure review results are available based on commit 2306c38.

Maintainers can request a fresh review after new comments, commits, or CI runs by commenting /review tests.

Overall Needs human investigation Failures 18 Baseline 4 on base Platform Android

Test Failure Review: Needs human investigation - click to expand

Overall 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 maui-pr build passed. No failure regressed deterministically versus main; however, the remaining incomplete and unattributed evidence prevents a ready-to-merge CI verdict.

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.

Failure Verdict On base? Evidence
DeviceTestsAndroid (Windows) - build error Needs human investigation flaky leg The same leg was green once and red four times across five sampled base builds; no WebView-specific failure was extracted.
ImageWithUndefinedSizeAndWithBackgroundSetRenders (Android) Needs human investigation no comparison A real Android device-test failure, but it exercises Image, not WebView; no readable exact baseline result was available.
device-test work item incomplete (com.microsoft.maui.controls.devicetests-Signed) Needs human investigation no comparison The Android Helix work item was incomplete, so its full result set could not be attributed.
com.microsoft.maui.controls.devicetests-Signed Work Item Needs human investigation no comparison Work-item failure without a specific changed WebView test or reliable baseline attribution.
CarouselView Does Not Leak With Default ItemsLayout Needs human investigation no comparison Unrelated control area, but no exact baseline evidence was available to dismiss the red result.
Controls Tests Work Item Needs human investigation no comparison Generic failed work-item record with insufficient test-level attribution.
Publish the mac_ui_tests_controls test results - build error Needs human investigation also-red leg The publisher leg was red in all five sampled base builds, but no exact failure match was available.
VerifyShellSearch_TextColor Needs human investigation 5/5 base green Persistent Windows Shell visual failure outside this Android WebView change; ci-scan #36419 records the leg failing on main, so the short-window regression was demoted rather than treated as PR-caused.
SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle Needs human investigation exact name; reason conflict The exact test appeared on base and the leg was red in all five samples; ci-scan #38135 tracks it, but differing failure reasons prevent deterministic dismissal.
SafeAreaPerEdgeValidation Needs human investigation exact name; reason conflict The exact test appeared on base and the leg was red in all five samples; ci-scan #38136 tracks it, but differing failure reasons prevent deterministic dismissal.
LayoutShouldBeCorrectOnFirstNavigation Needs human investigation also-red leg SafeArea test outside WebView scope; its leg was red in all five base samples and ci-scan #38137 records seven recent occurrences.
PickPhotosAsyncShouldReturnFromChildActivity Needs human investigation also-red leg Photo-picker test outside WebView scope; its leg was red in all five sampled base builds, without an exact baseline match.
DisplayAlertAsyncShouldNotCrashWhenPageUnloaded Needs human investigation exact name; flaky/reason conflict Exact-name base match, but the leg was green twice and red three times and the reasons differ; ci-scan #38016 tracks recurring MacCatalyst timeouts.
Publish the android_ui_tests_safeareaedges_controls_36 test results - build error Needs human investigation also-red leg Result-publisher failure on a leg red in all five sampled base builds; no exact changed-area failure was extracted.
Publish the android_ui_tests_controls_30 test results - build error Needs human investigation also-red leg Result-publisher failure on a leg red in all five sampled base builds; no exact changed-area failure was extracted.
Bugzilla57910Test Needs human investigation exact name; flaky/reason conflict Exact-name base match, but the leg was green twice and red three times and the PR failure reason differs; it still failed after retry.
RadioButtonShouldNotLeakMemory (Android) Needs human investigation no comparison RadioButton test outside WebView scope; no exact baseline result was available.
DisplayAlertAsyncShouldNotCrashWhenPageUnloaded (Android result) Needs human investigation no comparison Android test result has no exact baseline comparison; ci-scan #38016 concerns MacCatalyst and therefore cannot dismiss this platform result.

Recommended action

Do 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
  • PR scope: Android WebViewHandler, HybridWebViewHandler, native WebView clipping/cleanup, device tests, and Issue38080 UI coverage.
  • Passed changed-area legs: Android WebView Mono, Android WebView CoreCLR, iOS WebView, and macOS WebView.
  • Main build 1593769 passed.
  • Failing pipelines: UI tests 1593771 and device tests 1593772.
  • Compared baseline builds: UI tests 1593626 and device tests 1593627; baseline log coverage was incomplete, so unmatched failures remain indeterminate.
  • No Issue38080, changed WebView-handler test, HybridWebView test, or WebView test appears in the PR failure set.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review Summary

@kubaflo — new AI review results are available based on commit 2306c38.

Gate Passed Confidence Medium Platform Android


🗂️ 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.cs
  • src/Core/src/Handlers/WebView/WebViewHandler.Android.cs
  • src/Core/src/Platform/Android/MauiHybridWebView.cs
  • src/Core/src/Platform/Android/MauiWebView.cs
  • src/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 ScrollView while its fixed-height WebView is off-screen, or navigating back from that page, can terminate the process with a RenderThread SIGSEGV in GLFunctorDrawable/Skia. The reported software-layer workaround avoids the crash but is not an acceptable framework fix.
  • Base/head: main at local merge base 3823473d7d581aed7a51a9ab3d56973e12b4d1dc; materialized review head f4bc2bb5c350c66052e59442db7e2ee7dab11313 for upstream PR head 2306c38910944c2c2a7926cfaf38cd1dbee40ab0.
  • 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.cs
  • src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Android.cs
  • src/Core/src/Platform/Android/MauiWebView.cs
  • src/Core/src/Platform/Android/MauiHybridWebView.cs
  • src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt

Test changes:

  • src/Controls/tests/TestCases.HostApp/Issues/Issue38080.cs
  • src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38080.cs
  • src/Controls/tests/DeviceTests/Elements/HybridWebView/HybridWebViewTests_Initialization.Android.cs
  • src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBasementOfT.Android.cs
  • src/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:

  • NeedsContainer creates the wrapper for every Android WebView and HybridWebView.
  • SetupContainer preserves the normal wrapper setup and explicitly enables child clipping.
  • DisconnectHandler first detaches the wrapper, then clears HasContainer.
  • The handler-specific RemoveContainer intentionally reads the nullable non-generic ViewHandler.PlatformView, because IElementHandler.DisconnectHandler clears the generic platform-view property before invoking the handler callback. WrapperView.RemoveContainer safely takes its cleanup path when that value is null, removes all wrapper children, and clears ContainerView.
  • 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.json findings 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 WrapperView clipping (ClipChildren=true) replaces direct WebView ClipBounds; 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.json findings 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

  1. It is the only substantive implementation with empirical fail-without/pass-with evidence.
  2. Its abstraction boundary is narrower than #38181: generic Android view handlers remain unchanged.
  3. Its lifecycle cleanup is explicitly adapted to the platform-view-null-before-disconnect contract and is covered across reconnect and repeated disconnect.
  4. pr-plus-reviewer adds 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

⚠️ Deep UI tests — The deep UI run for 2 categories (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.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) and removed s/agent-review-in-progress AI review is currently running for this PR labels Sep 12, 2026
@kubaflo

kubaflo commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

CI follow-up for 2306c38910944c2c2a7926cfaf38cd1dbee40ab0:

  • The final-attempt TRX files show SafeAreaPerEdgeValidation, LayoutShouldBeCorrectOnFirstNavigation, PickPhotosAsyncShouldReturnFromChildActivity, Bugzilla57910Test, and RadioButtonShouldNotLeakMemory passing. Transient failures and superseded attempts should not be counted as current failures.
  • The Android Mono Helix job is complete: every work item finished. Controls XML reports 994 total / 981 passed / 1 failed / 12 skipped / 0 errors; its only failure is ImageWithUndefinedSizeAndWithBackgroundSetRenders.
  • The WinUI snapshot failure is real, but it is not a red-text rendering mismatch. In all five captures from retry run 43996220, the query-text pixels match the baseline. The entire image interior matches after excluding the diagnostic FocusStatus label: actual blank, baseline Focused (a one-pixel outer image border was also excluded for this analysis only). The fixture resets that label and repopulates it from focus events. No baseline or tolerance was changed, and the exact event sequence remains undetermined. Issue [ci-scan] Recurring: NavEvents_ShellItemChanged tests time out on Windows in maui-pr-uitests #36419 concerns different Shell navigation tests, not this snapshot failure.
  • I have retried only the canceled macOS Shell job, outer attempt 2 in build 1593771, at the same merge revision, to recover its missing final coverage. That retry is still running; the already-passing jobs were not restarted.

The Android WebView/HybridWebView results documented above remain green. This is a clarification of the evidence, not a blanket CI-clearance claim.

@kubaflo
kubaflo marked this pull request as ready for review September 13, 2026 15:41
Copilot AI lite review requested due to automatic review settings September 13, 2026 15:41
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo
kubaflo changed the base branch from main to inflight/current September 13, 2026 15:42
@kubaflo
kubaflo merged commit fa28bff into inflight/current Sep 13, 2026
153 of 170 checks passed
@kubaflo
kubaflo deleted the kubaflo-android-webview-crash branch September 13, 2026 15:43
@github-actions github-actions Bot added this to the .NET 10 SR12 milestone Sep 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

kubaflo added a commit that referenced this pull request Sep 15, 2026
…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.
kubaflo added a commit that referenced this pull request Sep 18, 2026
…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.
kubaflo added a commit that referenced this pull request Sep 21, 2026
…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.
kubaflo added a commit that referenced this pull request Sep 27, 2026
…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.
kubaflo added a commit that referenced this pull request Sep 27, 2026
…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.
kubaflo added a commit that referenced this pull request Oct 3, 2026
…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.
kubaflo added a commit that referenced this pull request Oct 3, 2026
…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.
kubaflo added a commit that referenced this pull request Oct 6, 2026
…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.
kubaflo added a commit that referenced this pull request Oct 6, 2026
…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.
kubaflo added a commit that referenced this pull request Oct 13, 2026
…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.
kubaflo added a commit that referenced this pull request Oct 13, 2026
…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.
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 14, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 2306c389 Deployed Sep 12, 2026 by kubaflo via conclusion #1879
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

3 participants