Repository navigation
[Release candidate] 11.0.1xx SR2 - #40116
Conversation
This comment has been minimized.
This comment has been minimized.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 40116Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 40116" |
fb3642b to
efcdca5
Compare
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…0174) This PR addresses the test failures that occurred in the Candidate/11.0.1xx-Ssr2 branch: #40116 , and includes updates to improve rendering and test stability across platforms. This PR adds and updates the expected baseline images for mac platform so the tests validate the current intended output. Updated Issue39880 tests to use ShardedTestCategory with CollectionView shard 1, fixing the MAUI0003 analyzer errors. ### Images - Border_StrokeMiterLimitWithStrokeLineJoin_Miter - Border_PolygonShapeWithStrokeLineJoin_Bevel - Border_StrokeShapeWithStrokeLineJoin_Bevel - Border_StrokeThicknessWithStrokeLineJoin_Bevel - Border_StrokeColorWithStrokeLineJoin_Round - NavigationBarColorIsPreservedAfterReturningFromModal - NavigationPageTitleViewShouldRespectMargins - Issue31445DuplicateTitleIconDoesNotAppear - TitleIconIsCentered ### Issues Fixed Fixes: #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ion (#40196) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly coordinated **candidate-integration build repair** for #40116, targeting `candidate/11.0.1xx-sr2`. The helper introduced by #39493 is not on `net11` or `main`; this PR changes only its three affected source files and does not import candidate contents into another branch. ### Description of Change <!-- Enter description of the fix in this section --> #39493 introduced `ItemsViewScrollHelper`, a non-obsolete shared helper whose CarouselView guard references the obsolete legacy `CarouselViewController`. With the repository's warnings-as-errors policy, this produces `CS0618` in `Controls.Core` for both `net11.0-ios27.0` and `net11.0-maccatalyst27.0`, preventing the UI sample from compiling. Move the CarouselView exclusions to the corresponding layout callbacks: - The already-obsolete legacy `ItemsViewLayout` checks `CarouselViewController`. - The current compositional layout checks `CarouselViewController2`. - The shared helper no longer depends on either controller. Its nullable collection parameter explicitly preserves the existing null/no-op path. Both built-in CarouselView handlers remain excluded from first-item scrolling. CollectionView scrolling, empty-section handling, RTL alignment, and `KeepLastItemInView` are unchanged. There are no public API changes, warning suppressions, test-assertion changes, or pipeline changes. #### Validation Validated with the candidate's SDK **11.0.101** (`global.json` provisioning version `11.0.101-servicing.26559.106`) and pinned iOS/MacCatalyst SDK **27.0.12230**. The reversible check ran on candidate `0be82c01b9f9dcc5d58684fa92fb493b0e8f9625`; the final committed build also passed after refreshing onto candidate `03a6ec676c`. ```sh .dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -c Release \ -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=true -p:IncludeMacCatalystTargetFrameworks=true \ -p:TreatWarningsAsErrors=true -v:quiet ``` **Passed: 0 warnings, 0 errors**, including both native Apple target frameworks. The causal check was baseline red (the two `CS0618` errors), repair green, complete repair reversion red after refreshing the candidate (the same two errors), and restored repair green. Commit `170cdfbcf8` was compiled successfully before pushing. ```sh .dotnet/dotnet format whitespace --folder \ --include src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs \ src/Controls/src/Core/Handlers/Items/iOS/ItemsViewScrollHelper.cs \ src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs \ --exclude Templates/src --verify-no-changes --verbosity minimal git diff --check ``` **Passed.** **Full UI-host packaging/runtime limitation:** an additional iOS simulator HostApp build stopped at the Apple SDK's toolchain check: SDK `27.0.12230` requires **Xcode 27.0**, while this machine has Xcode 27.1/27.2. The check was not bypassed. Native `Controls.Core` compilation above is verified; full HostApp packaging and runtime/UI tests are not claimed. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116. Repairs the Apple compilation regression introduced by #39493. Original CI evidence: [maui-pr-uitests build 1677816, Build Sample App log 188](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1677816/logs/188), showing `ItemsViewScrollHelper.cs(26,63): error CS0618` for both native Apple TFMs. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> This is the explicitly coordinated **candidate test-infrastructure port** of #40195, commit `6ea507c4f29cdf488df36df75855616109831467`, to `candidate/11.0.1xx-sr2`. The existing `main` PR remains the forward/shared-infrastructure repair; this separate branch port does not retarget or replace it. The HybridWebView gallery's `image.html` requests two remote Picsum images. Its DOM and expected title can already be ready while pending image requests keep `document.readyState` at `interactive`. Requiring `complete` makes the test host report a reload timeout despite having the expected document. Observed evidence: [candidate UI build 1677338](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1677338), test run `46750668`, result `100059`, exposes a native WebView titled **HybridWebView Image Page** while `StatusLabel` reports a timeout waiting for that title. The original shared sample is byte-identical across `main`, `net11`, and candidate; this is **not** a claim that #40116 introduced the problem. In `ReloadAndWaitForDocumentTitleAsync`, accept a parsed document (`document.readyState !== 'loading'`) without waiting for unrelated image downloads. Keep the old-document reload-pending marker, exact expected-title comparison, polling bounds, existing test assertions, and all visual baselines unchanged. The only source changes are the readiness predicate and its explanatory comment in one test-host file. No production APIs, handlers, timeouts, retries, skips, pipeline tests, or snapshots change. **Validation** - Verified that the candidate baseline and gallery document match the independently validated source, and that the entire modified C# file is byte-identical to #40195 (blob `588b381228a1744bbbf98710987731e6494be2f8`). The exact JavaScript expression matches the native-tested expression. - Reused the existing **iPhone 17e CoreSimulator / iOS 26.5 native UIKit/WKWebView evidence** from #40195: three independent runs passed all seven causal/safety cases using the repository's real `image.html`, changing only remote image URLs to controlled local responses. Cases: original red, trigger-removed green, fixed green, reverted red, restored green, stale-document marker rejected, and wrong expected title rejected. All 21 recorded outcomes were checked for this byte-identical port; the native runtime probe was not rerun for this PR. - `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/TestCases.HostApp/FeatureMatrix/HybridWebView/HybridWebViewControlPage.xaml.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` - passed. - `git diff --check` - passed. - Type-checked the existing native probe with `xcrun --sdk iphonesimulator swiftc -typecheck -parse-as-library -target arm64-apple-ios26.0-simulator` and the installed simulator SDK - passed, with two existing UIKit deprecation warnings. - Full candidate MAUI HostApp/Appium execution was **not run**. Candidate packaging was already blocked by the pinned Apple SDK's Xcode 27.0 requirement versus installed Xcode 27.1/27.2; no SDK pins or Xcode validation were bypassed. Native Android, Windows, and MacCatalyst verification were **not run**. The reused native WebKit evidence is not an end-to-end Appium or cross-platform pass. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40195. Fixes the candidate test-host's independently reproduced remote-image dependency in title readiness; does not close the release tracking PR or claim all candidate failures are fixed. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
1 similar comment
This comment has been minimized.
This comment has been minimized.
…ages (#40195) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> Fix shared test-host synchronization in `HybridWebViewControlPage`, targeting `main` as test infrastructure. No production HybridWebView API or handler changes. The `image.html` gallery requests remote Picsum images. Its DOM and document title can already be ready while those requests keep `document.readyState` at `interactive`. Requiring `complete` makes the sample report a reload timeout despite having loaded the expected document. The failure was observed in [candidate UI build 1677338](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1677338): run `46750668`, result `100059`, has a native WebView titled **HybridWebView Image Page**, while `StatusLabel` reports a timeout waiting for that very title. The corresponding title-readiness tests also fail on iOS and MacCatalyst. The sample is byte-identical on `main`, `net11`, and the candidate; this is not a claim that #40116 introduced it. Accept a parsed DOM (`readyState != loading`) instead of waiting for unrelated image downloads. Preserve the existing reload-pending marker, exact expected-title comparison, polling budget, test assertions, and all visual baselines. The image page already initializes its interactive controls on `DOMContentLoaded`. **Validation** - Built and ran a native UIKit/WKWebView probe on an **iPhone 17e CoreSimulator, iOS 26.5**. It serves the repository's actual `image.html`, routing only its remote image URLs to controlled held responses. **Three runs passed all seven causal/safety cases**: original predicate rejects the loaded interactive document; completing the image requests makes the original predicate pass; the changed predicate passes with images still pending; reverting it fails again; restoring it passes; an old-document reload marker is rejected; a wrong document title is rejected. The modified C# string was checked against the exact native-tested expression. - `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/TestCases.HostApp/FeatureMatrix/HybridWebView/HybridWebViewControlPage.xaml.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` - passed. - `git diff --check` - passed. - Full MAUI HostApp/Appium execution and native Android/Windows/Catalyst verification were **not run**. Native WebKit causal validation is not presented as an end-to-end Appium pass. No new pipeline tests, retries, timeout increases, skips, or snapshot updates. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116. Fixes the independently reproduced remote-image dependency in the shared HybridWebView feature-matrix readiness helper; does not close the release tracking PR or claim all its failures are fixed. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Windows pack failure analysismaui-pr 1678467 failed in Pack Windows, on merge
Windows: the errors occur in Controls' WebView event-argument types. RAR discovers Android: the first missing attributes include Proposed correction: make the native-resource/type consumer, The binlog has 49 error occurrences: 28 Windows compiler errors, 20 Android linker diagnostics, and one enclosing build-failed message. Dependent XAML, Maps, Foldable, Blazor, and NuGet projects are blocked by these failures rather than separate proven causes. Attribution as a newly introduced candidate regression versus an existing target-branch packaging defect is not yet established. The embedded narrow-restore assets snapshot does not establish the final on-disk assets contents at compile time. The separate unexpanded Binlog SHA256: |
…es (#38111) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details: - On Android, stream-backed images can throw ObjectDisposedException and remain blank when the Activity stops and resumes while Glide is still loading the image. ### Root Cause of the issue: - MAUI passed Glide a single managed stream instance. When an Activity stopped, the custom Glide loader's cleanup closed that stream. Glide then restarted the request after resume using the same closed stream, causing ObjectDisposedException and leaving the image blank. ### Description of Change **Image loading API changes:** * Added `PlatformInterop.loadImageFromBytes` methods for both `ImageView` and `Context` to allow loading images directly from byte arrays instead of streams, leveraging Glide for image rendering. * Updated `StreamImageSourceService` to read stream contents into a byte array before passing them to the new `PlatformInterop.loadImageFromBytes` methods, and removed manual stream disposal and related resource management code. **Testing improvements:** * Added a new test (`LoadDrawableAsyncSurvivesGlideRestart`) to verify that image loading is robust even when Glide is stopped and restarted mid-operation, using a custom `BlockingReadStream` to simulate delayed reads. * Introduced the `BlockingReadStream` helper class in the test suite to enable fine-grained control over stream read operations during testing. * Included necessary test imports for stream and threading support. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #37834 ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [ ] iOS - [ ] Mac ### Output | Before | After | |----------|----------| | <video src="https://github.com/user-attachments/assets/4a6b07f9-762a-4343-b24f-58890d9a927a"> | <video src="https://github.com/user-attachments/assets/4e057627-16b0-4b91-9068-63654a4b43c0"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…web content process ends (#40419) ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This adds public API, so it targets `main`. ### Description of Change On iOS and Mac Catalyst, a Blazor Hybrid app reloads itself and loses all UI state whenever the WKWebView's web content process (`com.apple.WebKit.WebContent`) ends, for example because it crashed or the system reclaimed it. Reporters see it after leaving the app minimized or on another Space for a while. `WebViewNavigationDelegate` in `IOSWebViewManager.cs` does not implement `webViewWebContentProcessDidTerminate:`. When no client handles the termination, WebKit reloads the page on its own ([`WebPageProxy::notifyClientOfProcessTermination`](https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/WebPageProxy.cpp)), and when the view is not visible it holds that reload back until it is. Blazor then attaches to the new page, `WebViewManager.AttachToPageAsync` disposes the old page context, and every component starts over. The app is never told. I reproduced it on demand on macOS 26.2 with MAUI 10.0.20 by killing the web content process, and wrote it up with logs in the issue: #24669 (comment). The repro app is https://github.com/Kebechet/maui-blazorwebview-reload-repro. **Change** - `WebViewNavigationDelegate` implements `ContentProcessDidTerminate` and raises the new `BlazorWebView.ProcessTerminated` event. - Implementing it turns WebKit's own reload off, so the new `WebContentProcessReloader` does that reload the way WebKit does (`notifyClientOfProcessTermination`, `maybeReloadAfterCrashWhenVisible` and `tryReloadAfterProcessTermination` in `WebPageProxy.cpp`): - It reloads right away when the web view is visible: in a window whose scene is not in the background, as `PageClientImpl::isViewVisible` decides on iOS. Otherwise it waits until the web view is added to a window or its scene comes back to the foreground. - A new navigation drops a pending reload, since it starts a web content process of its own. - Crash-loop limit: when the process ends again before a page has been loaded for 30 seconds after a reload, that termination is not reloaded. After skipping one, the next termination reloads again, as in WebKit. - When the process ended before the first page was committed, there is nothing to reload, so the page that was being loaded (`WKWebView.Url`) is loaded again, like WebKit does with its pending request. - `BlazorWKWebView`, a `WKWebView` subclass, raises `MovedToWindow` like `MauiWKWebView` does. Without it, `UIView.OnLoaded` only notices a window when the view's bounds change, which does not happen when the same web view is shown again at the same size. **Side effect:** this also changes how MAUI detects that a `BlazorWebView` is loaded on iOS and Mac Catalyst: through `MovedToWindow`, as for `WebView`, instead of the bounds observer. - Logged: `ReloadingAfterWebContentProcessTermination` (warning), `DeferringReloadAfterWebContentProcessTermination` (warning) and `NotReloadingAfterWebContentProcessTermination` (error). **API** | API | Notes | | --- | --- | | `BlazorWebView.ProcessTerminated` | `EventHandler<WebViewProcessTerminatedEventArgs>`, the same args as `WebView.ProcessTerminated`; `PlatformArgs.Sender` is the `WKWebView` | | `IBlazorWebView.ProcessTerminated(WebProcessTerminatedEventArgs)` | default interface member, so existing implementations keep compiling, like `IWebView.ProcessTerminated` | The event is raised before the reload, while the existing components and services are still alive, so an app can save the state it wants to restore once Blazor starts again. Open question for API review: the event does not tell the app whether a reload follows, or whether the crash-loop limit skipped it and the page stays blank. That would need a property on the event args, which `WebView.ProcessTerminated` shares, so I left it out for now. **Not covered here** - Android and Windows are not wired up. Android's `WebKitWebViewClient` does not override `OnRenderProcessGone`, and Windows does not handle `CoreWebView2.ProcessFailed`. Both need their own recovery work, so I kept this PR to iOS and Mac Catalyst. - The plain `WebView` has the same gap on iOS and Mac Catalyst: `MauiWKWebView` exports `webViewWebContentProcessDidTerminate:` on the `WKWebView` subclass, but WebKit sends it to the navigation delegate (`MauiWebViewNavigationDelegate`), so `WebView.ProcessTerminated` does not seem to fire there. That belongs in Core and is not changed here. - Keeping component state across a restart of the web content process would need support in `WebViewManager` in aspnetcore. ### Tests Device tests in `BlazorWebViewTests.ProcessTermination.iOS.cs` (it also compiles for Mac Catalyst). They end the web content process with `kill(pid, SIGKILL)`, which is what the system does to it. The pid comes from the private `_webProcessIdentifier` property, used only in the test. | Test | Covers | | --- | --- | | `WebContentProcessTerminationRaisesProcessTerminatedAndReloadsVisiblePage` | in a window: the event is raised with the web view as `Sender`, and Blazor renders the root component again right away | | `WebContentProcessTerminationReloadsHiddenPageOnceItIsInAWindow` | not in a window: the reload waits, and happens once the web view is added to a window | | `WebContentProcessTerminationRightAfterReloadDoesNotReloadAgain` | a second termination less than 30 seconds after the reloaded page loaded raises the event but does not reload | | `WebContentProcessTerminationLongAfterReloadReloadsAgain` | a second termination 30 seconds after the reloaded page loaded reloads again | | `WebContentProcessTerminationBeforeFirstPageLoadsLoadsThatPageAgain` | the process ends while WebKit decides on the first navigation, before anything is committed; the page is loaded again and Blazor starts | The two tests about the 30 seconds swap the handler's internal `TimeProvider` for a manual one, so they do not depend on timing. Run locally with xharness, `Category=BlazorWebView`, on `main` (331056d): | Run | Result | | --- | --- | | Mac Catalyst | 53 passed, 0 failed, 1 skipped | | iOS simulator 26.5 | 53 passed, 0 failed, 1 skipped | | Mac Catalyst, with three behaviors switched off: the web view always counts as visible, a reload is never forgotten, and `Reload()` is used even when nothing was loaded | exactly the three tests that cover them fail (hidden web view, termination after the 30 seconds, termination before the first page), the other two pass: 50 passed, 3 failed, 1 skipped | ### Issues Fixed Addresses #24669: apps are now told when the web content process ends, and BlazorWebView handles the reload itself instead of WebKit doing it silently. It does not stop the system from ending the process, and the UI state is still lost unless the app restores it. Co-authored-by: Jakub Florkowski <kubaflo123@gmail.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! ### Issue Details - Using a line geometry inside a geometry group can render the shape incorrectly across platforms and crash the application on Windows when the line follows a closed figure. ### Root Cause - Line geometry used a path-translation operation instead of starting a new figure, shifting existing geometry and generating an incorrect line path across platforms, which also caused a Windows rendering exception. ### Description of Change - Replace PathF.Move with PathF.MoveTo so each line starts at its declared StartPoint without modifying previously appended geometry. - Reference: [PathGeometry.AppendPath()](https://github.com/dotnet/maui/blob/e6abee71381e18cf81e8e7df3e3c538895f59d7f/src/Controls/src/Core/Shapes/PathGeometry.cs#L101) ### Issues Fixed Fixes #39950 ### Validated the behaviour in the following platforms - [X] Windows - [X] Android - [x] iOS - [x] Mac ### Output | Platform | Before Fix | After Fix | |----------|----------|----------| | iOS | <video src="https://github.com/user-attachments/assets/9853bad9-a635-4c64-a331-91600de73b1e"> | <video src="https://github.com/user-attachments/assets/20677c66-4707-4f9a-a94b-8fc099b5c72c"> | | Mac | <video src="https://github.com/user-attachments/assets/3320c07d-6249-4742-8c83-16e38c4731b5"> | <video src="https://github.com/user-attachments/assets/ca66ef90-0146-4ad1-8c68-c3bf55e25919"> | | Android | <video src="https://github.com/user-attachments/assets/1d01bfe0-b7e1-458e-b12e-8f1052243d77"> | <video src="https://github.com/user-attachments/assets/d997c434-6652-4250-8e8b-15dfb0176ff0"> | | Windows | <video src="https://github.com/user-attachments/assets/0027b0de-01f1-4b25-921c-a7b5c65ab38f"> | <video src="https://github.com/user-attachments/assets/b69452d5-9ad8-447a-8a0f-999fac102a75"> | Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…nt process ends before it starts loading (#40455) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This targets `candidate/11.0.1xx-sr2`, the same base as #40419. `WebContentProcessReloader` exists only on the SR2 candidate; it is not in `net11` or `main`. For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change `BlazorWebViewTests.WebContentProcessTerminationBeforeFirstPageLoadsLoadsThatPageAgain` was added in #40419. It fails on iOS for both the Mono and CoreCLR legs of the candidate's device-test build [1690816](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1690816) (head 8e70055): ``` System.TimeoutException : controlDiv never became 'Static' after the reload. Last value: '<null>'. ``` **Root cause.** The test ends the web content process from `UrlLoading`, which runs inside `DecidePolicy` for the first navigation, before that navigation starts. By the time `ContentProcessDidTerminate` is called, WebKit has already reset its page load state (`PageLoadState::reset`), so `WKWebView.Url` and `BackForwardList.CurrentItem` are both `null`. `WebContentProcessReloader.TryReload` assumed that "the page that was being loaded is still the web view's URL". It therefore fell back to `Reload()`, which has nothing to load, and the page never loaded. Temporary diagnostics confirmed this on an iOS 26.0 simulator. For this test the callback saw `url=<null> current=<null> visible=True`, so the reload ran immediately (no window wait) and still had no URL. WebKit avoids this with its own pending API request. `WebPageProxy::tryReloadAfterProcessTermination` loads `pendingAPIRequestURL` again when it is set, and calls `reload()` only otherwise. `pendingAPIRequest` is set by `loadRequest` and cleared when that navigation starts (`didStartProvisionalLoadForFrame`). It isn't exposed through `WKWebView`. **Fix.** - `WebContentProcessReloader` mirrors WebKit's pending API request. `PageRequested` remembers the page MAUI last asked for with `LoadRequest`, and `NavigationStarted` (`DidStartProvisionalNavigation`) forgets it. - `TryReload` loads that page again when it is still pending. Otherwise it keeps the existing behavior: load `Url` when there's no committed page, else `Reload()`. - `IOSWebViewManager` calls `PageRequested` for both of its `LoadRequest` calls: the start page in `NavigateCore`, and the app-scheme redirect re-issue. - The URL is stored as a string because `NavigateCore` disposes its `NSUrl`. - No test, public API or existing reload/throttle/window-wait behavior changes. Intentional difference from WebKit: WebKit also drops the pending request when the policy decision ignores that navigation. Here the page stays pending until a navigation starts. If the app cancels its start page in `UrlLoading` and the process later ends before any navigation starts, the reload asks for that page again. It still goes through `DecidePolicy`/`UrlLoading`, so the app's decision still applies. **Causal evidence.** iOS 26.0 iPhone 11 Pro simulator, Xcode 27.2. Each run used the full `BlazorWebView` device-test suite: ``` pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project BlazorWebView -Platform ios -DeviceUdid <udid> -OutputDirectory artifacts/<run> -SkipXcodeVersionCheck ``` | Run | Tree | Result | | --- | --- | --- | | Baseline | 8e70055 (candidate head) | **Red**: 61 passed, 1 failed (this test, same `'<null>'` error as CI), 1 skipped | | Fix | this PR | **Green**: 62 passed, 0 failed, 1 skipped | | Fix reverted | production change stashed | **Red**: 61 passed, 1 failed (same test, same error), 1 skipped | | Restored | this PR | **Green**: 62 passed, 0 failed, 1 skipped | All six `WebContentProcessTermination*` tests pass with the fix: - `RaisesProcessTerminatedAndReloadsVisiblePage` - `ReloadsHiddenPageOnceItIsInAWindow` - `RightAfterReloadDoesNotReloadAgain` - `LongAfterReloadReloadsAgain` - `BeforeFirstPageLoadsLoadsThatPageAgain` - `AfterThePageNavigatedByItselfReloadsTheNewPage` (added in 4bb40d5 after review; fails if `NavigationStarted` doesn't clear the pending request, otherwise 63 passed, 0 failed, 1 skipped) `dotnet format whitespace --verify-no-changes` passes on both files. MacCatalyst shares this code (`iOS/` folder) and was not run locally. In build 1690816 its BlazorWebView work items passed 62/63 at 8e70055 without this change, on macOS 15 (Helix c7a22071) and macOS 26 (Helix cf4220c0), so only iOS shows the failure. This PR's CI covers MacCatalyst with the change. **CI on merge 151ca05:** maui-pr [1691141](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1691141) succeeded. Device tests [1691443](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1691443) succeeded with 0 failed tests in all 9 runs (Android, iOS, MacCatalyst, Windows). All six tests above pass in the iOS Mono and CoreCLR runs on macOS 15 and 26 and in both MacCatalyst runs. Without this change, a rerun of 1690816's failed jobs at 8e70055 failed the same test again: across both attempts it failed 4 of 4 iOS runs on macOS 26 and 1 of 4 on macOS 15. ### Issues Fixed No separate issue is logged. This is a follow-up to #40419, found while auditing the SR2 candidate (#40116). <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ed Runnable (#40480) ### Description of Change On Android, every opacity change on a view with a `Shadow` posts a managed `Action` to redraw the shadow: `UpdateOpacity` calls `WrapperView.ScheduleInvalidate()`, which was `Post(() => Invalidate())`. Each `View.Post(Action)` creates a `RunnableImplementor` Java peer with its own JNI global reference, so a `FadeTo` on a shadowed view creates one peer per frame. On my emulator the peers were released after they ran, so the live count stayed flat while the app kept up; they pile up when the main looper falls behind, which is what the issue describes. `ScheduleInvalidate` now calls `PostInvalidateOnAnimation()`. It's a native call with no managed peer, it ends in the same virtual `Invalidate()` that `PlatformWrapperView` uses to mark the shadow dirty (#29764), and several calls within one frame are merged into a single invalidation. `UpdateOpacity` only calls it when the view is attached, as before. ### Tests `ViewHandlerTests.OpacityChangesOnShadowedWrapperInvalidateWithoutCreatingGlobalReferences` (Core device test, View category, Android) attaches a `WrapperView` with a shadow, changes the opacity 200 times in one synchronous block and checks that `JniRuntime.CurrentRuntime.GlobalReferenceCount` grew by less than 20. It then checks that the wrapper was still invalidated, so the shadow redraw isn't lost. Results on an API 37 emulator (Release, CoreCLR): | Category | Without the fix | With the fix | |---|---|---| | View | 73 passed, 1 failed, 2 skipped (`200 opacity changes created 200 JNI global references.`) | 74 passed, 2 skipped | | Layout, ShapeView, Border, ContentView | — | all passed | **Before / after** (sandbox app, Android emulator API 37, Release): the issue's shadowed `Border` in a `FadeTo` loop. The label counts `RunnableImplementor` messages dispatched on the main looper and shows the live JNI global references. The emulator only renders about 10 frames per second, so the rate is lower than on a device. | Before: 212 Runnable peers created, +12 per second | After: 9 (all from startup), +0 per second | |---|---| |  |  | Full clips: [before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/38003-before.mp4) · [after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/38003-after.mp4). The shadow stays visible and fades with the view in both. Not checked: the Mono runtime, the Issue29764 UI snapshot test and a physical device. ### Issues Fixed Fixes #38003 --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ated navigates again (#40479) ### Description of Change If a Shell `Navigated` handler starts another navigation, the page the first navigation left doesn't get `NavigatedFrom`; the Shell root gets it instead. On iOS that's fatal for the root: `Page` disconnects its handler when it gets `NavigatedFrom` for a pop and isn't in the stack, and the `ShellContent` root never is (`ShellSection`'s stack keeps a `null` placeholder for it). After going back, the root page is blank. `Shell.SendNavigating` stores the page being left in `_previousPage`. `SendNavigated` raises `Navigated` first and only then sends `NavigatedFrom`/`NavigatedTo` using `_previousPage`. A `GoToAsync` from the `Navigated` handler runs `SendNavigating` again, which overwrites `_previousPage` with the current page (the root), so the outer navigation's `NavigatedFrom(PopToRoot)` goes to the root. `SendNavigated` now copies `_previousPage` into a local and clears the field before raising `Navigated`, then uses the local for `NavigatedFrom`, `NavigatedTo` and the `PropertyChanged` unsubscribe. A navigation started from the handler keeps its own previous page. The reporter suggested the same change. One thing this doesn't change: when the nested navigation completes synchronously inside the handler (it does in unit tests), the popped page's `NavigatedFrom.DestinationPage` is the page the nested navigation went to, because it's still read from `CurrentPage`. ### Tests - `ShellLifeCycleTests.NavigatingFromNavigatedHandlerDoesNotRedirectNavigatedFrom` (Controls.Core.UnitTests) pushes a page, pushes a detail page from a `Navigated` handler on `PopToRoot`, then pops. The popped page must get `NavigatedFrom(PopToRoot)`, the root only `NavigatedFrom(Push)` to the detail page, and the detail page `NavigatedTo` from the root. Without the fix: `Expected: PopToRoot, Actual: null`. - `Issue37360` UI test (iOS), taken unchanged from the `/issue replicate` run on this issue, which failed there with "Root: disconnected; unexpected pops: 1". I couldn't run it under Appium locally; the same sequence in the sandbox app ends with "Root: connected; unexpected pops: 0" with the fix. Shell and page lifecycle unit tests: 594/594. Full Controls.Core.UnitTests: 6734 passed, 1 failed, the same failure as on clean `net11` (`TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull`, a decimal-comma locale issue on my machine). **Before / after** (sandbox app, iPhone 17 simulator, iOS 26.5): a Shell with a green root page; the app opens a modal, closes it while a `Navigated` handler pushes a detail page, then goes back to the root. The title view shows the root handler state and the root's last `NavigatedFrom`. | Before: the root page is blank, its handler disconnected after `NavigatedFrom(PopToRoot)` | After: the root page renders, handler connected | |---|---| |  |  | Full clips: [before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/37360-before.mp4) · [after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/37360-after.mp4) Not checked by hand: Android and Windows (the change is in shared Shell code). ### Issues Fixed Fixes #37360 --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nchecked, pressed state (#40472) <!-- 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! #### Issue Description On Android, a disabled, unchecked `CheckBox` should use its configured tint whether or not its native `Pressed` flag is set. When the reproduction sets that flag directly, the tint lookup returns the caller-provided fallback instead of the configured color. This is a forced native state, not a normal tap on a disabled checkbox. #### Root Cause The `disabledUnchecked` entry in the Android `ColorStateList` used `-state_pressed` instead of `-state_checked`. As a result, a disabled, unchecked checkbox with `state_pressed` set matched none of the tint rules. #### Fix Description Replace `-state_pressed` with `-state_checked` in the disabled/unchecked selector. The rule now matches disabled, unchecked checkboxes regardless of the pressed flag. The other three checkbox tint rules and their order are unchanged. ### Issues Fixed Fixes #40463 ### Validated the behaviour in the following platforms - [ ] Windows - [x] Android - [ ] iOS - [ ] Mac ### Output **Material3** | Before Fix | After Fix | |----------|----------| | <image width="250" height="600" src="https://github.com/user-attachments/assets/9cadfbc4-a599-4c8a-937c-361edc0604b4"> | <image width="250" height="600" src="https://github.com/user-attachments/assets/8d5503a6-18e0-42f7-a2a4-9e21ae2e05ec">| **Material2** | Before Fix | After Fix | |----------|----------| | <image width="250" height="600" src="https://github.com/user-attachments/assets/eb5f2969-9dd8-4309-982d-199fab1f40c4"> | <image width="250" height="600" src="https://github.com/user-attachments/assets/d309b071-4950-405d-948e-8f2cc83ef110">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… Icon Loading (#40461) <!-- 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! ### Root Cause Shell applies its configured tint directly to the `BottomNavigationView`, while MAUI does not set an explicit icon tint for individual tab items. During initialization, TabbedViewManager caches the navigation bar's original `ColorStateList` and later reuses it when an icon finishes loading asynchronously. When a delayed icon-load callback executes, it reapplies the per-item tint using the cached value returned by `GetItemIconTintColorState()`. If the Shell tint has already been updated, the cached tint is no longer valid. As a result, the callback overwrites the current bar tint for that icon with the stale startup tint. ### Description of Change When no explicit MAUI icon tint is set, a late-loading icon now uses the bottom bar's current tint instead of the tint captured After the fix, a late-loading selected bottom-tab icon keeps the bar’s current tint ### Issues Fixed Fixes #40405 ### Validated the behaviour in the following platforms - [ ] Windows - [x] Android - [ ] iOS - [ ] Mac ### Output | Before Fix | After Fix | |----------|----------| | <image src="https://github.com/user-attachments/assets/843a0b91-96f4-4c6e-984e-08026198c005"> | <image src="https://github.com/user-attachments/assets/da468821-be23-465e-9924-d354c1e0c7cd">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.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! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change **Root cause:** `Window.Destroying()` disconnects the window's own handler but never the handlers of the pages it presents, `Window.Page` and the modal stack. When the next window gets a new page (the templates' `CreateWindow` returns `new Window(new MainPage())`), nothing ever disconnects the old page tree. For a `BlazorWebView` that means `BlazorWebViewHandler.DisconnectHandler` never runs: the `WebViewManager` is not disposed, components never get `Dispose`/`DisposeAsync`, and their timers, loops and JS calls keep running next to the new instance. On Android it is not limited to rotation. Measured with the Blazor Hybrid template on MAUI 10.0.130 (Pixel 6, Android 16), with a component that logs a tick every 2 seconds and logs its disposal: | Trigger | Result | | --- | --- | | System font size change (not in the template's `ConfigurationChanges`) | The activity is recreated with a new window and a new `MainPage`; the old component keeps ticking and is never disposed | | Back on the root route, then opening the app again, both times started through a launcher intent (`monkey -c android.intent.category.LAUNCHER`) | Back finishes the activity (`OnDestroy`, `IsChangingConfigurations` false) while Android keeps the process; the relaunch starts a second Blazor app and the first one's component keeps ticking | A language change and rotation without `ConfigChanges.Orientation` take the same activity-recreation path; I did not measure them separately. **Fix:** `Window.Destroying()` calls `DisconnectHandlers()` on the modal pages and the page it presents, so `HandlerDisconnectPolicy.Manual` is respected. - **Only pages that still belong to this window** (`Parent == this`). An app that reuses one page instance can already have put it into a newer window when the old one is destroyed, and its handlers then belong to the new window. - **After the window's own handler is disconnected.** Disconnecting the page raises `HandlerChanged`, and `Window.OnPageHandlerChanged` subscribes the alert manager whenever the window still has a handler, so earlier it would subscribe the destroyed window again. - **Before `DisposeWindowScope()`** (iOS, Mac Catalyst, Windows), so handlers can still use the window's services while they disconnect. The scope is disposed in a `finally`, so a handler that throws does not leave it behind. This is a behaviour change for every app: a destroyed window now tears down its page tree instead of leaving it connected. | Case | Before | After | | --- | --- | --- | | New page in the new window (templates) | Old page tree stays connected for the life of the process | Disconnected when the old window is destroyed | | Same page instance shown again in a new window, after the old window is destroyed | The new window creates new handlers; `Element.SetHandler` disconnects the old ones | Old handlers disconnected at destroy; the new window creates new handlers | | Same page instance already moved to a newer window | Untouched | Untouched (`Parent` is the newer window) | | A view with `HandlerDisconnectPolicy.Manual` | Untouched | Untouched, with its subtree | | Windows: a `BlazorWebView` in a closed window | `BlazorWebView.Windows.cs` already closes the WebView2 on `Window.Destroying` | Same, then the handler disconnects | ### Tests Unit tests (`Controls.Core.UnitTests`): - `WindowsTests.DestroyingDisconnectsHandlersOfThePage`: a page, a layout and a button, each with a handler; after `Destroying()` all three are disconnected. - `WindowsTests.DestroyingKeepsHandlersWithManualDisconnectPolicy`: a layout with `HandlerDisconnectPolicy.Manual` keeps its handler and its child's; the page is still disconnected. - `WindowsTests.DestroyingKeepsHandlersOfAPageMovedToANewerWindow`: the page moves to a second window and gets a new handler; destroying the first window leaves that handler connected. - `ModalNavigationPlatformTests.DestroyingDisconnectsRootAndModalPageHandlers`: the root page and a pushed modal page are both disconnected. - `ModalNavigationPlatformTests.DestroyingKeepsHandlersOfAModalPageMovedToANewerWindow`: a pushed modal page is put into a second window and gets a new handler, while the first window's modal stack still lists it; destroying the first window disconnects its root page and leaves the modal's new handler connected. Device test (`MauiBlazorWebView.DeviceTests`): - `BlazorWebViewTests.DestroyingWindowDisposesRootComponents`: a `BlazorWebView` in a page in a window renders a component that records its disposal; after `Destroying()` the component is disposed and the `BlazorWebView` has no handler. Run locally on this branch's base `net11` (d1bb681), devices on Android only (Pixel 6, Android 16); iOS, Mac Catalyst and Windows were not run: | Run | Without the fix | This branch | | --- | --- | --- | | The new unit tests | The first three fail. `DestroyingKeepsHandlersOfAPageMovedToANewerWindow` was added with the `Parent` check and fails on this PR's first commit, which had none. `DestroyingKeepsHandlersOfAModalPageMovedToANewerWindow` fails with only the modal `Parent` check removed | 5 of 5 pass (a23b8bd) | | `Controls.Core.UnitTests`, all | | 6738 passed, 30 skipped, 0 failed (a23b8bd) | | `MauiBlazorWebView.DeviceTests`, all | 69 run: 64 passed, 4 skipped, 1 failed (the new test times out: the component is never disposed) | 69 run: 65 passed, 4 skipped, 0 failed (f55e17c; a23b8bd only adds unit tests) | End to end, on the same Pixel 6 with the Controls gallery built from this branch: I switched its start page to `BlazorPage` and made its index component log a tick every 2 seconds and its disposal (local edits, not part of this PR). Two font-size changes each disposed the old component before the new one started, and Back on the root route followed by a relaunch through the launcher disposed it as well. Only the newest component kept ticking. Not measured: whether the old `MainPage`/`BlazorWebView` instances are garbage-collected afterwards, which the issue's expected result also mentions. This PR makes sure they are disconnected and their components disposed. ### What NOT to Do (for future agents) - ❌ **Don't disconnect `Window.Page` unconditionally.** A reused page can already belong to a newer window; check `Parent == this`. - ❌ **Don't disconnect the pages before the window handler.** The page's `HandlerChanged` would subscribe the alert manager on a window that is being destroyed. - ❌ **Don't fix this in `BlazorWebViewHandler`.** The handler cannot know that its window went away; every handler that owns work of its own has the same problem. ### Issues Fixed Fixes #40056 --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> 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! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change **Root cause:** on Android, `BlazorWebView` installs its own `BlazorWebChromeClient`, and it never overrode `OnShowCustomView`. The Android WebView only lets web content enter fullscreen when the `WebChromeClient` overrides `OnShowCustomView`, so inside a `BlazorWebView` `document.fullscreenEnabled` is `false`, `element.requestFullscreen()` rejects with `TypeError: Fullscreen is not supported`, and the fullscreen button of `<video>` is disabled. The `WebView` control got fullscreen support in #15472, but that code lives in `MauiWebChromeClient`, which `BlazorWebView` does not use. **Fix:** - The `OnShowCustomView`/`OnHideCustomView` code of `MauiWebChromeClient` moves into an internal `WebViewFullScreenPresenter` in Core, and both chrome clients delegate to it, so `WebView` and `BlazorWebView` enter and leave fullscreen the same way. The view the page puts in fullscreen covers the decor view, the activity turns to landscape and hides the system bars; on exit the view is removed, the orientation is restored and the system bars come back. - `BlazorWebViewHandler` passes the hosting activity to `BlazorWebChromeClient`, which keeps it in a weak reference as `MauiWebChromeClient` does. - `BlazorWebViewHandler.DisconnectHandler` calls `BlazorWebChromeClient.Disconnect()`, which leaves fullscreen if it is showing and refuses to enter it again. The WebView keeps the chrome client until its components are disposed, so the page can still ask for fullscreen in that time, and the handler then detaches the client before destroying the WebView, so Chromium's own `OnHideCustomView` never arrives. Without this, the overlay, the landscape lock and the hidden system bars would stay on the activity. A request after `Disconnect()` gets `OnCustomViewHidden()` and shows nothing. Changes in the moved code, which also apply to `WebView`: - **Fullscreen no longer changes `WindowCompat.SetDecorFitsSystemWindows`.** Leaving fullscreen set it to `true`, while `MauiAppCompatActivity` sets it to `false`. With that policy, one fullscreen round trip moved the app's content down by the status bar height: `android.R.id.content` went from y=0 to y=128 on an API 34 emulator, and stayed at 0 on Android 16 (API 36). Android has no getter for this policy on API 30+, so the presenter cannot put the app's own value back; it also does not need to change it, because the custom view goes on the decor view, outside the content that the policy pads, and the system bars are hidden while it shows. - **The status bar, the navigation bar and the caption bar are restored separately** (API 30+). Before, `Show` combined their visibility with OR, so an app with only one of them visible got all of them back after fullscreen. Below API 30 the presenter still assumes all bars were visible, as before. - `Hide` does nothing unless a view is showing. Before, a stray `OnHideCustomView` reset the orientation to a stale value. - `Show` without an activity, or with one that is finishing, destroyed or has no window attached, calls `OnCustomViewHidden()` right away, so the page does not stay in a fullscreen state that nothing displays. Before, a missing activity was ignored, and a detached window threw a `NullReferenceException` reading its insets. No public API change. `WebViewFullScreenPresenter` is internal (Core already grants `InternalsVisibleTo` to `Microsoft.AspNetCore.Components.WebView.Maui`), and `MauiWebChromeClient` only loses private fields. **Behaviour a `BlazorWebView` now inherits from the `WebView` control:** any element the page puts in fullscreen, not only `<video>`, gets the landscape orientation and the white background the `WebView` code sets, and the window keeps the `BehaviorShowTransientBarsBySwipe` system bar behaviour after fullscreen. Not covered here: `WebView` still does not leave fullscreen when its handler disconnects, and `HybridWebView` sets no chrome client, so its content cannot enter fullscreen either. ### Tests Device tests in `BlazorWebViewTests.FullScreen.Android.cs`: - `WebContentReportsFullScreenAsEnabled` reads `document.fullscreenEnabled` from a running `BlazorWebView`. - `ShowCustomViewCoversActivityUntilHidden` drives the WebView's chrome client. After `OnShowCustomView` the custom view is a child of the activity's decor view and the orientation is landscape. After `OnHideCustomView` the view is removed, the orientation is restored and `OnCustomViewHidden` was called once. - `DisconnectingHandlerLeavesFullScreen` shows a custom view and disconnects the handler; the view is removed, the orientation is restored and `OnCustomViewHidden` was called once. - `ShowCustomViewAfterDisconnectIsRejected` disconnects the handler, then asks the still attached chrome client for fullscreen; nothing is shown and `OnCustomViewHidden` is called once. - `ShowCustomViewWithoutActivityReportsTheViewHidden` and `ShowCustomViewWithoutAWindowOnScreenReportsTheViewHidden`: a chrome client with no activity, or with an activity that has no window, reports the view hidden and keeps no showing state. - `HidingAgainAfterLeavingFullScreenChangesNothing` leaves fullscreen, changes the orientation, calls `OnHideCustomView` again and checks the orientation and the callback count do not change. - `LeavingFullScreenKeepsTheActivityEdgeToEdge` gives the activity the edge-to-edge policy of `MauiAppCompatActivity`, enters and leaves fullscreen, and checks the content has not moved. - `LeavingFullScreenKeepsAHiddenStatusBarHidden` (API 30+) hides the status bar, enters and leaves fullscreen, and checks the status bar is still hidden and the navigation bar is as it was. The tests that show a custom view put the activity back in a `finally` (overlay, orientation, system bar behaviour) and wait for the rotation and bar animations to finish. They run against the test runner's activity rather than `Platform.CurrentActivity`, because the external navigation tests start activities that finish themselves, and the current activity can still point at one of those. All `MauiBlazorWebView.DeviceTests`, run with xharness on a Pixel 6 (Android 16, API 36) and an API 34 emulator (Google APIs, x86_64), on this branch's base `net11` (d1bb681): | Run | Pixel 6, API 36 | Emulator, API 34 | | --- | --- | --- | | Without the fix (only the first two tests existed then) | 70 run: 64 passed, 4 skipped, 2 failed, both new tests (`fullscreenEnabled` is `false`; the custom view never reaches the decor view) | not run | | Without the `DisconnectHandler` change | 71 run: 66 passed, 4 skipped, 1 failed (`DisconnectingHandlerLeavesFullScreen`: the overlay stays on the decor view) | not run | | All the tests above, with the product code as of 0d6eaf5 (before the review follow-up) | 77 run: 70 passed, 4 skipped, 3 failed: `ShowCustomViewAfterDisconnectIsRejected` (the view lands on the decor view), `LeavingFullScreenKeepsAHiddenStatusBarHidden` (the status bar comes back), `ShowCustomViewWithoutAWindowOnScreenReportsTheViewHidden` (`NullPointerException`) | 77 run: 69 passed, 4 skipped, 4 failed: the same three, and `LeavingFullScreenKeepsTheActivityEdgeToEdge` (the content moves from y=0 to y=128) | | This branch, at its head commit (93871d5) | 77 run: 73 passed, 4 skipped, 0 failed | 77 run: 73 passed, 4 skipped, 0 failed (the same files, run just before the commit message was amended) | `HidingAgainAfterLeavingFullScreenChangesNothing` and `ShowCustomViewWithoutActivityReportsTheViewHidden` cover guards that were already in 0d6eaf5; each fails when its guard is removed (the orientation is reset to `Unspecified`; the callback count is 0). API 19 to 29 were not run. By hand, in a template Blazor Hybrid app on MAUI 10.0.130 with a copy of this code installed from app code as the `BlazorWebView`'s chrome client: a tap that calls `requestFullscreen()` on a `<video>` resolves, the element goes fullscreen in landscape with the system bars hidden, and Back leaves fullscreen with the page layout as it was. The video file itself did not load on that network, so this checked the fullscreen handling, not playback. That check predates the review follow-up. ### What NOT to Do (for future agents) - ❌ **Don't copy the fullscreen code into `BlazorWebChromeClient`.** The two controls would drift apart; share `WebViewFullScreenPresenter`. - ❌ **Don't test fullscreen by calling `requestFullscreen()` through `EvaluateJavascript`,** as the device tests run script. That gives the page no user activation, so the call rejects. `document.fullscreenEnabled` does not depend on one. - ❌ **Don't call `SetDecorFitsSystemWindows` in the presenter.** Android cannot report the app's value on API 30+, so whatever the presenter sets on exit overrides the app's layout policy. - ❌ **Don't use `Platform.CurrentActivity` in these device tests.** After the external navigation tests it can be an activity that finished in `OnCreate` and has no window. ### Issues Fixed Fixes #22049 --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…akly (#40453) ### Description of Change `OrientationStateTrigger` and `DisplayRotationStateTrigger` subscribe to the static `DeviceDisplay.MainDisplayInfoChanged` when attached and unsubscribe when detached. Triggers only detach when the element's window changes, and `Window.Destroying` doesn't clear `Page`. So when Android recreates the Activity, the old page keeps its window, its triggers stay subscribed, and the static event keeps the whole old page alive (trigger → `VisualState` → setters → old page). Every recreation leaks another page, and the dead triggers keep reacting to rotation. The triggers now subscribe through a new `WeakDisplayInfoChangedProxy`, built like the existing `WeakNotifyCollectionChangedProxy` in `WeakEventProxy.cs`. Each trigger keeps its handler in a field, because the proxy only holds it weakly. A proxy whose trigger was collected removes itself on the next display change. Unlike `VisualElement` and `Border`, the triggers don't unsubscribe from a finalizer: removing the last handler stops the platform display listeners, which shouldn't happen on the finalizer thread. `FlyoutPage` has a similar static `MainDisplayInfoChanged` subscription; I left it out of this PR. ### Tests New tests in `OrientationStateTriggerTests` and `DisplayRotationStateTriggerTests` (Controls.Core.UnitTests): - `AttachedTriggerDoesNotKeepPageAlive` keeps a page with the trigger in a window that is never torn down and checks that the page can be collected. Without the fix both fail with "Page should not be alive!". - `TriggerStillUpdatesAfterGarbageCollection` forces a GC and checks that the trigger still reacts to a display change. It fails if the handler isn't kept alive by the trigger. The trigger tests go from 32/34 to 34/34. The full Controls.Core.UnitTests run has the same single failure as clean `net11` (`TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull`, a decimal-comma locale issue on my machine). **Before / after** (sandbox app, Android emulator API 37, Release): the issue's XAML plus a "Collect and count" button that counts pages still alive. The Activity is recreated three times by changing the font scale. | Before: all 4 pages are still alive | After: only the current page is alive | |---|---| |  |  | Full clips: [before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/40450-before.mp4) · [after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/40450-after.mp4). The after clip also rotates the emulator to show the [landscape template](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/40450-after-landscape.png) still switches. Not checked: iOS, Mac Catalyst and Windows (shared code, not run there), Debug builds and a physical device. ### Issues Fixed Fixes #40450 --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
) ### Description of Change An iOS app that sets `MainPage` and has a scene manifest crashes with `InvalidOperationException: Window was already destroyed` every time the user swipes it away in the app switcher. When the scene disconnects, `SceneDidDisconnect` calls `Destroying()` on the window. `Application.RemoveWindow` returns early for the `MainPage` window, so that window, already destroyed, stays in `Application.Windows`. UIKit then calls `applicationWillTerminate`, and the `WillTerminate` handler calls `app.GetWindow()?.Destroying()` on it a second time. Its comment assumes `GetWindow()` is null by then, which isn't true for `MainPage` apps. `WillTerminate` now skips a window whose handler is already disconnected, which is what `Destroying()` leaves behind. If terminate arrives without a prior scene disconnect, the window is still destroyed. I chose this over the `!HasSceneManifest()` guard the neighbouring handlers use because it depends on the window's state, not on Info.plist. #24191 was closed with "use CreateWindow", but the scene manifest is now in the .NET 11 templates and required by the iOS 27 SDK, so every app that still uses `MainPage` hits this crash on force-close. ### Tests `WindowTests.WillTerminateDestroysMainPageWindowOnce` (Controls device test, Window category, iOS and Mac Catalyst) sets `MainPage`, connects the window, optionally calls `Destroying()` as `SceneDidDisconnect` does, then runs the registered `WillTerminate` handlers. It checks that nothing throws and that `Destroying` runs exactly once in both cases. On the iPhone 17 simulator (iOS 26.5), Window category: 53/57 without the fix (the 4 failures are the scene-disconnect cases, with the same stack as the issue), 57/57 with it. Application 1/1 and Lifecycle 9/9 with the fix. **Before / after** (sandbox app with `MainPage` set, Release build, swiped away in the app switcher with Appium; the app logs a line after MAUI's own handlers finish). There's no video because the app disappears either way. Before: ``` [KeyWindow] Scene will invalidate: UIWindowScene ... [40438] SceneDidDisconnect handlers finished *** Terminating app due to uncaught exception 'System.InvalidOperationException', reason: 'Window was already destroyed (System.InvalidOperationException) at Microsoft.Maui.Controls.Window.Microsoft.Maui.IWindow.Destroying() at Microsoft.Maui.LifecycleEvents.AppHostBuilderExtensions.<>c.<OnConfigureLifeCycle>b__2_1(UIApplication app) at Microsoft.Maui.MauiUIApplicationDelegate.WillTerminate(UIApplication application) ``` After: ``` [KeyWindow] Scene will invalidate: UIWindowScene ... [40438] SceneDidDisconnect handlers finished [40438] WillTerminate handlers finished ``` `xcrun simctl terminate` kills the process without calling `applicationWillTerminate`, so it doesn't reproduce this. Not checked: Mac Catalyst (no local workload) and a physical device. ### Issues Fixed Fixes #40438 --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…resh (#40429) <!-- 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! ### Issue Details - On iOS/macOS, a horizontal CollectionView hosted inside a RefreshView loses its horizontal scroll position when a button triggers a refresh. After scrolling toward the end of the collection and initiating a refresh, the list unexpectedly returns to the beginning. - On Android and Windows, the horizontal scroll position is maintained correctly during refresh, and the issue does not occur. ### Root Cause - The iOS RefreshView reset horizontal scrolling because its refresh-related vertical offset assignments also overwrote the native scroll view’s X offset with zero. ### Description of Change - Preserve the native scroll view’s current X offset whenever RefreshView adjusts Y at refresh start or completion, preventing unintended horizontal resets. ### Issues Fixed Fixes #40422 ### Validated the behaviour in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac ### Output | Before Fix | After Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/035fd456-f67e-473a-b316-6325e96896c9"> | <video src="https://github.com/user-attachments/assets/ab8fb417-d154-4701-a6e6-27881913808c"> | Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…on (#40420) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details On Android, navigating between Shell tabs could display the wrong TitleView or toolbar color. This occurred with the legacy Shell renderer. ### Root Cause When the app navigated to another top tab, the page content changed, but the toolbar still pointed to the previous page. As a result, it could show the previous page’s title. ### Description of Change When the selected tab changes, update the toolbar to use the newly selected page before displaying it. This keeps the toolbar title in sync with the page. Validated the behavior in the following platforms - [x] Android - [ ] Windows - [ ] iOS - [ ] Mac ### Issues Fixed Fixes #40342 ### Output ScreenShot |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/89b0ae4c-a346-4211-a7e7-0e54741fe304" >| <video src="https://github.com/user-attachments/assets/5a132507-e546-424a-8299-166beeeac93f">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…dItemsLayout in CollectionView (#40368) <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Issue Details: On Windows CV1, a CollectionView using GridItemsLayout stops firing RemainingItemsThresholdReached after item containers are recycled. The Scrolled event also reports incorrect visible item indexes. The handler counted positions within realized containers rather than actual collection indexes, preventing the remaining-items threshold from being reached. ### Description of Changes: Updated ItemsViewHandler.Windows.cs to read FirstVisibleIndex and LastVisibleIndex directly from ItemsWrapGrid for ungrouped sources. This keeps indexes accurate after recycling and allows incremental loading to continue. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #40239 <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> **Tested the behavior in the following platforms.** - [ ] Android - [x] Windows - [ ] iOS - [ ] Mac | Before | After | |---------|--------| | **Windows**<br> <video src="https://github.com/user-attachments/assets/03d920e1-3abf-496d-a611-6ae3a353bb43" width="600" height="300"> | **Windows**<br> <video src="https://github.com/user-attachments/assets/7e49b7f7-c588-45a0-bacc-c77ddf28230b" width="600" height="300"> | Co-authored-by: Jakub Florkowski <kubaflo123@gmail.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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details After opening RegularPage in TabItem3, switch to TabItem2 and navigate directly to TabItem3’s modal page. The modal may flash or disappear, leaving the wrong tab selected. Expected: the modal stays open, and dismissing it reveals TabItem3’s root. ### Root Cause Shell prepares TabItem3’s history before selecting it. On iOS, removing a page from a hidden tab can wait for a “page shown” notification that never arrives. Cleanup can also dismiss and reopen the new modal while removing RegularPage, causing flashing. ### Description of Change On iOS, removing a page from a hidden tab no longer waits for a message saying the page is visible. The fix removes the old RegularPage while keeping the new modal open, instead of closing and reopening it. Validated the behavior in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes #11430 ### Output ScreenShot |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/82ff1d89-6af9-43f2-a5c7-7b763293a51f" >| <video src="https://github.com/user-attachments/assets/d4119e49-1675-42f0-bed4-bf3f68de204a">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
#40295) <!-- 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! ### Root cause During Shell-item opening transitions, temporary ancestor transforms can cause safe-area padding to be calculated from transient screen coordinates. The padding can remain incorrect after the transition finishes, leaving top-aligned destination content underneath the status bar. ### Description of Change Register a private fragment-lifecycle callback in Android ShellRenderer to request fresh window insets when the current Shell-item fragment resumes. Filter out unrelated fragments and unregister/dispose the callback when the renderer disconnects. Add a TODO to move the refresh to ShellItemRenderer.OnResume in .NET 12. Add renderer-specific tests covering modal-to-ShellItem/TabBar navigation, custom item renderers, repeated resume without another transition, and centered-content positioning. ### Issues Fixed Fixes #35759 ### Screenshots | Before | After | |---------|--------| | <video src="https://github.com/user-attachments/assets/fa8bfc77-4538-47bc-9ff9-4f2b200299ce" Width="600" Height="400"/> | <video src="https://github.com/user-attachments/assets/8640bc43-0183-4168-b8b0-cf8a17203fe2" Width="600" Height="400"/> | --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…dits (#40418) <!-- 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! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). Targets `main`: this is XAML incremental hot reload work, like #39928, and it adds a generator-only public API. ### Description of Change When a `Setter.Value` changed on a keyed `Style` or a `Class` style in a root `ResourceDictionary`, `UpdateComponent()` emitted something like `((Setter)node!).Value = "Blue";`. That assigns an unconverted string and never reapplies the style, so existing consumers kept stale values. With lazy resources, even new consumers kept them. #39928 fixed implicit styles by replacing the dictionary entry. That doesn't help keyed or Class styles, because `StaticResource`, `StyleClass` and `BasedOn` consumers hold the `Style` instance directly. Changes: - **Generator** (`UpdateComponentCodeWriter`, `SetPropertyHelpers`): setter-value edits on keyed and Class styles in a root RD now rebuild the style through the normal IC visitor pipeline, as for implicit styles, and call `XamlComponentRegistry.TryUpdateStyle`. Fallback when that returns false: - Lazy keyed styles: replace the factory. - Eager keyed styles: assign the dictionary entry. - Class styles: no fallback, since they live in a shared per-class list. The implicit-style path is unchanged. - **`XamlComponentRegistry.TryUpdateStyle`** (new public, `EditorBrowsable(Never)`): finds the live style without forcing lazy factories. That means a shared, already-materialized lazy entry, an eager entry, or the single matching entry in a class list. If only the setters changed, it replaces them in place; otherwise it returns false. "Only the setters" means the same TargetType, Class, BasedOn, BaseResourceKey, ApplyToDerivedTypes and CanCascade. - **`Style.ReplaceSetters`** (internal): unapplies the old setters from all tracked targets, swaps them, and reapplies the new ones with each target's specificity. Derived-style consumers are covered because a base style tracks them with `AsBaseStyle` specificity. Local values still win. - **`ResourceDictionary.TryGetLocalMaterializedValue`** / **`LazyResource.TryGetCachedValue`** (internal): let the helper peek at an entry without resolving it. Known limitations: - Existing consumers of `x:Shared="False"` styles can't be refreshed, because the instances aren't tracked. New consumers get the new value. - Styles declared in a page's own `Resources` are out of scope; this matches #39928, which also covers only root resource dictionaries. ### Issues Fixed Fixes #39984 ### Validation New tests are in `src/Controls/tests/SourceGen.UnitTests/HotReload/Maui39984Tests.cs`, run with both lazy and eager RD. I added a `LazyRD` option to the test harness for them. They cover: - the generated patch shape - live StaticResource, DynamicResource and locally overridden consumers - `BasedOn` propagation - StyleClass consumers - unresolved lazy styles and `x:Shared="False"` styles The new tests failed (8 of 8) before the fix. Commands run: - `DOTNET_MODIFIABLE_ASSEMBLIES=debug dotnet test Microsoft.Maui.Controls.SourceGen.UnitTests.dll --filter "FullyQualifiedName~Maui39984|FullyQualifiedName~Maui39780"`: **Passed**, 14/14. I ran it from a copy of the build output outside the `~`-containing worktree path. - Same command, full SourceGen.UnitTests suite: **Passed**, 683/683. - `dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj`: 6733 passed, 1 failed. The failure is `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull`, which also fails without this change: it's locale-dependent ("3,14" vs "3.14"). - `dotnet build src/Controls/src/Xaml/Controls.Xaml.csproj -f netstandard2.0`: succeeded with no PublicAPI errors. I did not test this on a device or in Visual Studio. --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
#39979) <!-- 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! This pull request improves the behavior and reliability of flyout selection in the Windows Shell implementation, ensuring that the flyout selection accurately reflects the current navigation state, especially when navigation is deferred or canceled. It also introduces a new test to verify this behavior. ### Description of Change Flyout selection and navigation synchronization: * Added a handler for the `SelectionChanged` event in `ShellView` to keep the flyout selection in sync with the current navigation state, even in cases where navigation is deferred or canceled. This ensures the UI accurately represents the user's navigation choices. [[1]](diffhunk://#diff-88fb406b4ca307f3f0b311eeed169f73ff14eca302df683ed771cc433538e817R37) [[2]](diffhunk://#diff-88fb406b4ca307f3f0b311eeed169f73ff14eca302df683ed771cc433538e817R74) [[3]](diffhunk://#diff-88fb406b4ca307f3f0b311eeed169f73ff14eca302df683ed771cc433538e817R253-R263) [[4]](diffhunk://#diff-88fb406b4ca307f3f0b311eeed169f73ff14eca302df683ed771cc433538e817L276-R306) Testing improvements: * Introduced a new theory test, `FlyoutSelectionFollowsDeferredNavigation`, in `ShellTests.Windows.cs` to verify that the flyout selection correctly follows the navigation outcome, both when navigation is accepted and when it is canceled. This test covers scenarios with deferred navigation and ensures that the flyout selection updates accordingly. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #18495 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/116ebf64-5c8d-465d-962d-ba9264276712"> | <video src="https://github.com/user-attachments/assets/09e8d35d-4351-4735-9e53-4d79439f3c9c"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> --------- Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…UI-test build break (#40484) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). Base is `candidate/11.0.1xx-sr2`. The broken file exists only there: it came from #40479, which targeted the candidate, and `net11` (d1bb681) does not contain `Issue37360.cs`. For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change This fixes a deterministic candidate build break introduced by #40479 (ac121b0). That PR added `Issue37360.cs` with `[Category(UITestCategories.Shell)]`. `Shell` is a CI-sharded category, so the UITest analyzer (`NUnitTestMissingCategoryAnalyzer`, `CiShardCategoryPrefixes` = CollectionView and Shell) reports error **MAUI0003**: ``` src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue37360.cs(19,14): error MAUI0003: Test method 'RootRemainsConnectedAfterModalDismissalNavigatesToDetail' uses the sharded category 'Shell' directly; use `[ShardedTestCategory(UITestCategories.Shell, shard: ...)]` so both the umbrella and CI shard categories are registered [src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj] ``` The file is wrapped in `#if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST`, so only `Controls.TestCases.iOS.Tests` compiles it. As a result: - Every candidate `maui-pr` macOS build from ac121b0 onward fails. For example, build [1692715](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1692715) @ d5925a3 failed both "Build macOS (Debug)" (log 260) and "Build macOS (Release)" (log 242) with exactly this error. - The iOS UI-test project cannot build in `maui-pr-uitests` either. The fix is a one-line change from `[Category(UITestCategories.Shell)]` to `[ShardedTestCategory(UITestCategories.Shell)]`, matching the existing precedent in `Issue38799.cs`. The attribute registers both the `Shell` umbrella category and the `Shell1` shard. The iOS UI-test matrix runs `Shell1` and `Shell2` (`eng/pipelines/common/ui-tests.yml:51-52`), so the test still runs. Shard 1 is the lighter shard (217 vs 252 Shell tests). No test logic, assertions, timeouts or skips are changed. #### Validation All builds ran locally on macOS at candidate e064224 with SDK 11.0.100. Command, with the non-test platform TFMs disabled because only the `net11.0` test project is needed: ``` dotnet build src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -c Debug \ -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false ``` | State | Result | | --- | --- | | Baseline (candidate e064224) | **Failed**: 1 error, MAUI0003 at `Issue37360.cs(19,14)`, identical to CI | | With fix | **Succeeded**: 0 errors | | Fix reverted | **Failed**: MAUI0003 again | | Fix restored | **Succeeded**: 0 errors | I also searched the repository: no other test method in `TestCases.Shared.Tests` applies a sharded category directly in a way that fails the analyzer, and the green build compiles every iOS-included test. ### Issues Fixed No separate issue: this fixes a candidate build break introduced by #40479. Found while auditing candidate PR #40116. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… device tests (#40486) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is SR2 candidate integration work for #40116, so it targets `candidate/11.0.1xx-sr2`. #40457 was merged straight into the candidate (0eb47dd) and `net11` doesn't have it, so there is nothing to revert on `net11`. ### Description of Change This reverts #40457 ("Window: Disconnect page handlers when the window is destroyed"), which crashes the Controls device-test apps on Android, iOS and Windows and leaves MacCatalyst Controls device tests without results. #40457 changed `Window.Destroying()` to disconnect the handlers of the window's page and modal stack. Platform callbacks still run after `Destroying()`, and when they reach the now-disconnected handlers the process crashes: | Platform | Crash | Stack | | --- | --- | --- | | iOS (CoreCLR + Mono, iOS 18 and 26 queues), Controls.DeviceTests-General | `InvalidOperationException: Page cannot be null here` | `ControlsModalWrapper.UpdateBackgroundColor` ← `ControlsModalWrapper.ViewWillAppear` (the modal is dismissed after window teardown) | | iOS (CoreCLR + Mono), Controls.DeviceTests-Shell | `InvalidOperationException: VirtualView cannot be null here` | `ShellPageRendererTracker.Dispose` ← `ShellSectionHandler.DisposePage` ← `OnPopRequested` | | Android (CoreCLR + Mono), API 33 | `ArgumentNullException` for `context` | `ShellSectionRenderer.OnCreateView`. A pending fragment transaction runs after teardown, and `FindMauiContext()` returns null. | | Windows (packaged + unpackaged) | `0xc000027b`, faulting module `Microsoft.UI.Xaml.dll` | Process crash during the Controls device tests (attributed by mechanism; not reproduced locally) | | MacCatalyst (CoreCLR, osx.15 + osx.26) | No test results | osx.15 `Controls Tests` ran into the 3600 s XHarness timeout (exit 94, `TEST_RESULTS_MISSING`; the app was still alive). On osx.26 the app exited after about 6 minutes with no results file, and XHarness still reported success. Without #40457, both queues report 1636–1777 tests in about 12 minutes (8 runs in builds 1690816, 1692066, 1692670, 1692736). Attributed by correlation; not reproduced locally. | **CI** (`maui-pr-devicetests` on the candidate branch): | Build | Candidate head | Contains #40457 | Result | | --- | --- | --- | --- | | [1692670](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1692670) | b828f7b | no | Controls device tests passed | | [1692843](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1692843) | e064224 | yes | Helix work items crash: iOS General + Shell on all four iOS legs; Android CoreCLR + Mono; Windows packaged + unpackaged; MacCatalyst `Controls Tests` produced no results on either queue | The revert is a full `git revert` of 0eb47dd (5 files, +2/−214). It restores `Window.cs` and removes the tests #40457 added: - `BlazorWebViewTests.WindowDestroying.cs` and `DisposalTrackingComponent.razor`; - the `WindowsTests` and `ModalNavigationPlatformTests` unit tests for the destroy-disconnect behavior. These tests are removed together with the behavior they assert. No unrelated test is changed. #40457 merged without a `maui-pr-devicetests` run, so these crashes first showed up after it landed on the candidate. ### Local evidence Each run starts from candidate head a6d3ad9. The "re-apply" step reverts the revert (`git revert --no-commit HEAD`), which gives back a tree byte-identical to a6d3. **iOS, `Category=Modal`** (CoreSimulator iPhone 16 Pro, iOS 26.5): | Step | Result | | --- | --- | | a6d3 (with #40457) | RED: APP_CRASH, `Page cannot be null here` from `ControlsModalWrapper.UpdateBackgroundColor` | | This revert | GREEN: 222/222 passed | | Re-apply #40457 | RED: same exception | | Revert restored | GREEN: 222/222 passed | **Android, `Category=Shell`** (emulator API 35, arm64): | Step | Result | | --- | --- | | a6d3 (with #40457) | RED: APP_CRASH (XHarness exit 80), FATAL `ArgumentNullException: context` at `ShellSectionRenderer.OnCreateView`, right after `FlyoutContentUpdatesAfterChange` (identical to CI) | | This revert | No crash | | Re-apply #40457 | RED: same FATAL | | Revert restored | GREEN: 197/197 passed, XHarness exit 0, no FATAL | The first revert run had 4 `ShellRendererTransitionTests` failures (193/197). They didn't come back when the revert was restored (197/197), so they're intermittent and unrelated to this change. **iOS, `Category=Shell`** on this branch: no crash; the `VirtualView cannot be null here` path is gone. - On iOS 26.5, `FlyoutHeaderLabelsAreArrangedWhenBoundTextChangesWithoutResizingHeader` (#39877) failed 2/552. It is a layout assertion, and this PR doesn't touch layout. - The same `Category=Shell` run on an iPhone 11 Pro **iOS 18.5** simulator (the device CI uses is iPhone 11 Pro, iOS 18.1) passed 552/552, XHarness exit 0. - CI b828 also passed that test on iOS. So the iOS 26.5 failure is local-environment only and unrelated to this revert. ### Re-landing #40056's fix The BlazorWebView disposal leak from #40056 is still worth fixing. A re-land needs to tolerate callbacks that arrive after `Window.Destroying()`: - the iOS modal wrapper's `ViewWillAppear`/dismissal; - Android fragment transactions that are still pending; - Windows window close. It should also run `maui-pr-devicetests` (Controls: Modal, Shell, General) on all platforms before merging. cc @Kebechet ### Issues Fixed Relates to #40056 and #40116 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…40389 (#40512) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This PR targets the SR2 release candidate, `candidate/11.0.1xx-sr2`. That is where both #39898 (which added the test and baseline) and #40389 (which changed the rendering) merged. The failure exists only on the candidate. It is the remaining deterministic UI-test failure on #40116. For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change Test-only change. It refreshes one Android baseline, `TestCases.Android.Tests/snapshots/android-notch-36/Issue35410_Landscape.png`. The test, tolerance, crop and comparer are unchanged. **Why the baseline is stale** - #39898 (merged 11-12) added `Issue35410.TextRemainsVisibleAfterLandscapeRotation` and its API 36 landscape baseline. - #40389 ("[Android] Let ScrollView content scroll under safe-area padding", merged 11-18) made the Android ScrollView stop clipping to its safe-area padding. Content now draws into the bottom inset while the padding still applies at the scroll extents. That change did not update this baseline. - Since #40389, every candidate run of `Controls SafeAreaEdges (API 36 Pixel 3 XL)` fails this test at **0.54%**, on both the original attempt and the in-job retry. Examples: UI builds 1688778, 1689023, 1690796, 1694038 and 1694047. The same job passed 185/185 on 1688241, the last candidate build before #40389. **What changed in the image** (old baseline vs CI actual, both 2960x1276) - 89,248 pixels differ by more than 16 levels, all in the bottom 32 rows (1244–1275). The next row's label is now drawn there instead of the page background, which is #40389's intended behaviour. - Above row 1244, 1,104 pixels differ, none by more than 1 level. The notch-side horizontal inset and all visible text are unchanged, so what #39898 protects (text staying visible and clear of the notch after rotation) is still covered. **The new baseline is deterministic.** It is the CI actual from candidate UI build 1694038 (run 47304978, result 100184, attachment 11; sha256 `c80e438e…`). It is pixel-identical (max channel difference 0) to the actuals from build 1694047 (run 47303796) and build 1690796. Only the PNG date metadata differs. **Causal check.** I compiled the repo's unchanged `VisualTestUtils` + `MagickNetVisualComparer` sources (Magick.NET-Q8-AnyCPU 14.17.2, same 0.005 threshold) into a small harness. I then compared each baseline revision against the three independent CI actuals: | Stage | Baseline | 1694038 actual | 1694047 actual | 1690796 actual | | --- | --- | --- | --- | --- | | Before (`a61b68cb`) | old | FAIL 0.54% | FAIL 0.54% | FAIL 0.54% | | Fix (this PR) | new | PASS | PASS | PASS | | Fix reverted | old | FAIL 0.54% | FAIL 0.54% | FAIL 0.54% | | Restored | new | PASS | PASS | PASS | I retried the failed job on builds 1694038 and 1694047 (runs 47309610 and 47309596), producing five more landscape actuals. All five pass against the new baseline and fail at 0.54% against the old one. The `Controls SafeAreaEdges (API 36 Pixel 3 XL)` job on this PR's own UI-test CI is the on-device confirmation. Maintainers: please confirm the new bottom-inset rendering is the intended post-#40389 appearance (cc author of #40389). If it is not, the fix belongs in `ScrollViewHandler.Android.cs`, not in this baseline. ### Issues Fixed Fixes the candidate-only `Issue35410` Android API 36 UI-test failure on #40116. There is no separate issue for it. Related: #35410, #39898, #40389. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…40531) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This PR targets the SR2 release candidate, `candidate/11.0.1xx-sr2`, because this intermittent failure is the only remaining UI-test failure on #40116 (UI build 1694858 at candidate `e3c8b2ec`). The test is the same on `net11` and `main`, so the change applies there too. For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change Test-only change to `Issue2241.ChangeOrientationCheckScroll`. Product code, the host page and the shared Appium helpers are unchanged. **Root cause: the test reads the layout mid-rotation** `App.SetOrientationLandscape()` / `SetOrientationPortrait()` return as soon as the driver accepts the orientation change. They don't wait for the rotation to finish, which on iOS animates for roughly 300–400 ms. The test called `GetRect()` immediately after rotating back to portrait, so it sometimes read an intermediate frame of `MainGrid` instead of the settled layout. - Settled portrait layout: `MainGrid` at y=211 with height 400, so CenterY = **411** (the expected value). - Values seen mid-animation: **249** and **251** in CI; 211–248 locally. In the local failing runs, the page source captured at teardown shows the grid back at x=20, y=211, 335×400 (CenterY 411). The ScrollView layout settles correctly; only the read was early. This is not a product regression. **CI evidence** - UI build 1694858 (candidate `e3c8b2ec`), `Controls (v18.5) ScrollView`, run 47329666: `Expected: 411 But was: 249`, then `251` on the in-job retry. - 421 iOS ScrollView job runs scanned across `main`, `net11`, inflight, candidate and unrelated PRs. The same assertion also failed on candidate build 1684453 (235), #40307 (262) and #40263 (263). It is an intermittent that occurs on every branch at about 1%, not a candidate regression. **Fix** After each rotation, the new `WaitForMainGridToSettle` helper polls `MainGrid` every 100 ms until two conditions hold: 1. The rect shows the rotated layout: wider than portrait after going to landscape, narrower than landscape after going back. 2. The rect has been identical for two consecutive reads. It fails with the last rect if this doesn't happen within 10 s. The assertion itself is unchanged: portrait CenterY before and after the scroll must be equal. **Causal validation (local, iOS 18.5 iPhone Xs simulator — the CI configuration)** `dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj --no-build --filter "Name=ChangeOrientationCheckScroll"`, repeated in a loop with `HEADLESS=true`: | Stage | Test code | Result | Observed CenterY on failure | | --- | --- | --- | --- | | Baseline | original | **6 of 15 failed** | 211, 224, 224, 234, 224, 233 | | Fix | this PR | **20 of 20 passed** | — | | Trigger removed | original + `Thread.Sleep(3000)` after each rotation | **12 of 12 passed** | — | | Fix reverted | original | **9 of 15 failed** | 224, 233, 224, 211, 232, 248, 211, 224, 233 | | Restored | this PR | **15 of 15 passed** | — | Adding only a delay after rotating removes the failure, which confirms the timing cause. The fix doesn't slow the test noticeably: it took about 20 s per run, as before. The test also runs on Android. On an Android API 30 emulator (the CI API level), the fixed test passed 4 of 4 runs (4–7 s each) via `pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Name=ChangeOrientationCheckScroll"`, so the rotation-and-settle wait also holds there. ### Issues Fixed Fixes the intermittent `Issue2241.ChangeOrientationCheckScroll` iOS UI-test failure on #40116. There is no separate issue for it. Related: #2241. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…aseline (#40539) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a coordinated rollback on `candidate/11.0.1xx-sr2`, where both reverted PRs landed. Their changes are not present on `net11`. For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> Restore the Android ScrollView behavior from before #40389 while the compatibility impact and any future opt-in/opt-out design are considered. Revert, in reverse dependency order: - #40512 (`e3c8b2ec8cb9e6e78a4ddf90aca9dda177c27aa5`): restore the previous `android-notch-36/Issue35410_Landscape.png` baseline. - #40389 (candidate commit `93995479185ce7594f4b771cc99a26745e0d23e7`): remove the unconditional `SetClipToPadding(false)` and remove the device test requiring content to draw under safe-area padding. **Behavior:** ordinary Android ScrollViews once again use Android's default padding clipping. Scrolling content no longer draws into the native safe-area/keyboard padding bands. Existing special-case behavior, including Shell flyout overrides, is unchanged. The three changed paths exactly match their versions immediately before #40389. The original issue #37306 is intentionally no longer fixed by this change. The earlier #39898 landscape/notch fix and all unrelated changes are preserved. Searches for #40389, #37306, clipping-related follow-ups, and subsequent changes to the affected paths identified #40512 as the only merged dependent follow-up. No feature flag or review-workflow changes are included. **Validation** - `git diff --cached --check` - passed. - `git diff --cached --quiet 9399547^ -- src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.Android.cs src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Issue35410_Landscape.png` - passed; exact pre-change source/test/baseline restoration. - `dotnet format whitespace --folder --include src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs --verify-no-changes` - passed. - `dotnet build Microsoft.Maui.BuildTasks.slnf -c Release -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -v:q` - passed. - `pwsh -NoProfile -File .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform android -TestFilter 'Category=ScrollView' -Rebuild -OutputDirectory <session-artifacts>/scrollview-rollback-final -Timeout 00:10:00` - passed, **13 passed / 0 failed / 0 skipped**, Release arm64 Android API 34 emulator; verified from fresh result XML. The same full-rebuild command with the candidate's production handler temporarily restored also passed 13/13. The final source contains the rollback. Earlier incremental attempts encountered a missing-result-file error and `DoesNotLeak` GC failures (12/13); these are disclosed rather than counted as passing. Both full-rebuild comparison runs passed. The full-solution formatter could not complete with missing unrelated project references and was stopped; the targeted formatting check above passed. The default all-platform BuildTasks command failed because the installed Apple workloads support 27.2 rather than the branch's 27.0; the Android-scoped prerequisite build passed without repository configuration changes. The API 36 notch screenshot UI test was **not run locally**; its baseline is restored byte-for-byte, and CI still needs to validate that configuration. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Reverts #40389 and its dependent baseline update #40512. Related: #37306, #35410, #39898, #40116. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
All tests passed |
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!
Target Branch
mainnet11, for reviewFor .NET 11 fixes, only a maintainer retargets the approved PR to the active
inflight lane and merges it after CI validates that final base. Do not merge
individual fixes directly into
net11; agents must not retarget or merge.Description of Change
Tracks
candidate/11.0.1xx-sr2intonet11.Current release integration. Merge only after normal release review and validation. Use Create a merge commit, not squash or rebase: next-lane preparation verifies the exact two-parent candidate integration.
Release workflow
The highlighted branch is the lane tracked by this PR.
flowchart LR Candidate["candidate/11.0.1xx-sr2"] -->|Release integration| Fixes["net11"] Inflight["inflight/11.0.1xx-sr3"] -.->|Next release preview only| Fixes Fixes -->|Pin approved source| Staging["automation/release/11.0.1xx-sr2"] Staging -->|Review servicing PR and Create a merge commit| Reviewed["Reviewed servicing merge on staging"] Reviewed -->|Maintainer manually cuts at exact merge| Release["release/11.0.1xx-sr2"] Fixes -->|Daily forward merge| Features["main (features)"] Inflight -->|Signed nightlies after cutover| Feed["ci.inflight dogfood feed"] style Candidate stroke:#2563eb,stroke-width:3pxStatus: draft tracking PR, not a release approval. Normal review and CI are required before integration. Versioned nightlies retain the legacy stream until the internal cutover is verified.
The candidate retains CI settings and includes the upcoming version in both bug-template dropdowns. After its approved merge, automation pins automation/release and independently opens reviewed next-cycle CI normalization on net11. The publication workflow automatically opens a servicing/stable configuration PR against automation/release. Review it and merge using Create a merge commit, then manually create the real release branch at that exact reviewed servicing merge commit. No second post-cut servicing PR is opened.
After reviewed normalization, the same workflow prepares the next candidate/inflight branches, draft PR pair and canonical state PR without waiting for servicing review or a real release cut. Publication waits for the exact reviewed staging merge to be manually cut and verifies the receipt, human approvals, two-parent merge and exact internal mirror. Public package publishing remains explicitly approved.
Issues Fixed
N/A - release integration tracking.