Repository navigation
Conversation
Detach the HybridWebView wrapper before base OnDisconnecting unwraps its native view. Keep native client cleanup in typed disconnect and preserve existing clipping and protected container API. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 35de8bc6-f5d1-4ff4-9cd2-e38b15c785b0
kubaflo
temporarily deployed
to
copilot-pat-pool
October 22, 2026 18:21 — with
GitHub Actions
Inactive
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39570Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39570" |
kubaflo
temporarily deployed
to
copilot-pat-pool
October 22, 2026 18:21 — with
GitHub Actions
Inactive
This comment has been minimized.
This comment has been minimized.
kubaflo
temporarily deployed
to
copilot-pat-pool
October 22, 2026 18:22 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
October 22, 2026 18:24 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
October 22, 2026 18:27 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
October 22, 2026 18:27 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The native lifecycle change needs human confirmation because current CI and reported Android execution results were not independently verified.
No open issues 🎉
What changed in this PR
This PR adapts Android HybridWebView teardown to the net11.0 pre-disconnect lifecycle, preventing the old native WebView from remaining in its host container. The title and description match the supplied diff.
Changes:
- Detach the wrapper in
OnDisconnecting()before base container cleanup can reparent the WebView. - Remove late container cleanup from typed
DisconnectHandler, retaining client disconnection andStopLoading().
| File | Description |
|---|---|
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Android.cs |
Moves wrapper detachment earlier and clarifies the existing container-cleanup comment. |
Review effort: Balanced
This was referenced Oct 23, 2026
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
/review expert-review |
This comment has been minimized.
This comment has been minimized.
Contributor
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit ac8870b.
Open
3 tasks
Collaborator
PR Test Gate |
3 tasks
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Fix the Android
HybridWebViewTests_Initialization.DisconnectHandlerRemovesClippingContainerbaseline failure onnet11.0, independently of the GC fixture change in #39536.ElementHandlernow callsOnDisconnecting()before clearingPlatformView. The genericViewHandler.OnDisconnecting()removes the container while the platform view is still available. Normal Android unwrapping moves that platform view into the wrapper's old parent. By the time the HybridWebView-specific typedDisconnectHandlerruns,ContainerViewis already null, so its late detachment cannot prevent the old WebView from remaining in the outerFrameLayout.Detach the HybridWebView wrapper in a private-protected
OnDisconnecting()override, before calling the base implementation. Base cleanup can then empty the detached wrapper and resetHasContainer/ContainerViewwithout reparenting the old WebView into the host. Keep client disconnection andStopLoading()in typed native cleanup.This is intentionally Android/HybridWebView-only:
RemoveContaineroverride and public API intact.ClipChildren=true, and absence of explicit WebViewClipBounds.ViewHandler,WrapperView, Windows wrapper policy, tests, assertions, timing, dependencies, or pipelines.The failure is present in both Android Mono and CoreCLR in the original #39536 device build 1644557 and exact-base build 1643729, with
Assert.Null()receiving an AndroidFrameLayout. It is not caused by the GC fixture change.Native causal validation
Local environment: repository-pinned .NET SDK
11.0.100-rtm.26514.118(product version11.0.100), Android workload37.2.15, Android API 33 ARM64, Mono, private headless emulatoremulator-5708, native WebView109.0.5414.123. Base:7b0ea7800db3f3faccbaecb665d32b7c61eaf932.Executed the unchanged six-case initialization class, not a proxy reproduction. Each repeat starts a fresh app process and uses a unique device/result XML filename. The temporary module initializer supplied by the
run-device-testsskill restricts XHarness toMicrosoft.Maui.DeviceTests.HybridWebViewTests_Initialization; it is not committed.Assert.Null/ actualFrameLayoutThe existing regression case checks wrapper/native detachment, an empty old wrapper, cleared handler container state, fresh wrapper/native instances and clipping after reconnect, and repeated disconnect. The five siblings exercise initialization callbacks and native settings; every sibling passed in every causal arm. One preliminary baseline execution also reproduced the same failure; the table reports the three fully recorded repeats.
The broader
TestFilter=Category=HybridWebViewrun on the restored fix also passed: 101 total / 96 passed / 5 existing skips / 0 failures / 0 errors. Actual XML contains 99 HybridWebView cases (94 passed, 5 skipped), plus two uncategorizedAlertDialogTestscases included by the existing category runner (both passed). It covers JavaScript evaluation/invocation, .NET dispatch, message origins, raw messages, content-root resolution, request interception, initialization, and disconnect/reconnect. No filter, skip, or assertion in the repository was changed.Commands and observed results (
$Eis the untracked session evidence directory;$APKis the arm-specific copy of the built signed Controls APK):Local causal validation is Mono-only; no local CoreCLR, Apple, Windows, desktop UI, or RenderThread overscroll-crash validation is claimed. An idle emulator-backend abort occurred between completed fixed runs and the reverted run; only the task-owned AVD was restarted. Reverted and restored evidence comes from subsequent fresh processes and newly written XML, not reused results. The task-owned AVD has been stopped and removed.
Open and recently merged PRs were checked for HybridWebView disconnect/container cleanup,
OnDisconnecting, and this Android handler path; no equivalent fix was found. #38467 is preserved, not replaced or duplicated.Issues Fixed
Repairs the independent Android HybridWebView baseline failure surfaced during #39536 validation. Existing regression coverage: #38467. This does not close or modify #39536.
Intentionally targets
net11.0: this adapts HybridWebView teardown to that branch's pre-disconnect container lifecycle. Nomain, release, or GC fixture changes are included.