Repository navigation
Conversation
…on backports (#40217) <!-- 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. !!!!!!! --> ### Description of Change **Explicit release-target exception:** this PR intentionally targets the new `release/10.0.1xx-sr14` branch. `main`, `net11` and the inflight lanes are now .NET 11, so .NET 10 SR14 is cut from the SR13 release head (`release/10.0.1xx-sr14` was created at `54d76458e0`, the tip of `release/10.0.1xx-sr13`, which already includes all post-cut SR13 fixes #39830, #39855, #39879, #39891 and the servicing/stable configuration from #39774). This PR brings the .NET 10 changes needed since SR13: 1. **Backport #39887** – `[Windows] Prevent duplicate Shell startup navigation from stale tab selection events`. Fixes #39859 (regressed in 10.0.120); it was merged only to `main`. Clean `cherry-pick -x`. 2. **Backport #40132** – `Fix custom Shape.PathForBounds dispatch regression`. Fixes #40129 (regressed in 10.0.130); it was merged only to `candidate/11.0.1xx-sr2`. The unrelated .NET 11 `eng/release-rollover.json` change from that commit is excluded (file does not exist on the .NET 10 line). 3. **Version bump** – `PatchVersion` 130 → 140 in `eng/Versions.props`. Servicing label and `StabilizePackageVersion=true` are inherited from SR13. Reviewed and intentionally **not** included: - #40136 (`net10.0` Publish-Build-Assets cleanup): SR13 has no `Publish-Build-Assets` references, so nothing to remove. - #39882 (re-land of the CollectionView2 height fix): SR13 already carries the revert #39855 that fixed #39847; re-landing is a fix-forward, not a regression fix. - #40213 (`[net10.0][XSG]` CA2252 suppression, issue #40045): still open/unmerged; can be backported once approved. - Other `regressed-in-10.0.1x0` issues closed since the SR13 cut (#38622, #39557/#39681, #39722) are already fixed on SR13 or were fixed outside MAUI. Keep in draft pending review and CI. This PR does not tag, publish, or authorize a release; the internal dnceng mirror of `release/10.0.1xx-sr14` has not been created. #### Validation Using the pinned SDK `10.0.113` provisioned by `eng/common/dotnet.sh`: - `dotnet msbuild eng/Versions.props -getProperty:PatchVersion,SdkBandVersion,PreReleaseVersionLabel,StabilizePackageVersion,DotNetFinalVersionKind` → `140`, `10.0.100`, `servicing`, `true`, `release`. `xmllint --noout eng/Versions.props` passed. - `dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -f net10.0 --filter FullyQualifiedName~StrokeShapeTests` (platform TFMs disabled): **passed 59/59**. With `Shape.cs` reverted to SR13: **failed 3/59** (the new `CustomShapeReimplementingIShape*` tests); restored: **passed 59/59**. - #39887 is Windows-only (`ShellItemHandler.Windows.cs` + Windows device test) and was not built locally on macOS; it relies on CI. ### Issues Fixed Fixes #39859 Fixes #40129 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
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.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit b474cdf.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…tion attribute (#40213) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change On MAUI 10.0.x, when `MauiAllowImplicitXmlnsDeclaration` is defined, the XAML source generator emits `[assembly: AllowImplicitXmlnsDeclaration]` into `GlobalXmlns.g.cs`. That attribute is marked `[RequiresPreviewFeatures]`. CA2252 is suppressed only if the app assembly carries `[assembly: RequiresPreviewFeatures]`. The SDK adds that attribute only when `EnablePreviewFeatures=true` **and** the project targets the SDK's latest TFM (`IsNetCoreAppTargetingLatestTFM`). A `net10.0` app built with the .NET 11 SDK therefore fails with `GlobalXmlns.g.cs(15,12): error CA2252`. Visual Studio picked a .NET 10 SDK, which is why the build passed there and failed from the CLI. Defining `MauiAllowImplicitXmlnsDeclaration` is already the explicit opt-in, and the runtime, XamlC and SourceGen paths only check that the attribute is present. So the generator now wraps the emitted attribute in `#pragma warning disable/restore CA2252`. The public attribute is unchanged; user code that applies it by hand still gets CA2252 as before. **Tests:** `Maui40045Tests` runs `XamlGenerator` with the `MauiAllowImplicitXmlnsDeclaration` symbol on a compilation that has no `[assembly: RequiresPreviewFeatures]`, then runs the real CA2252 analyzer from `Microsoft.CodeAnalysis.NetAnalyzers` over the result. The analyzer path comes from the project's resolved `@(Analyzer)` items. **Validation:** - `dotnet test src/Controls/tests/SourceGen.UnitTests/SourceGen.UnitTests.csproj --filter FullyQualifiedName~Maui40045`: passes with the fix. It fails without the fix with `GlobalXmlns.g.cs(15,12): error CA2252`. - `dotnet test src/Controls/tests/SourceGen.UnitTests/SourceGen.UnitTests.csproj`: 180 passed, 0 failed. - End-to-end: a `net10.0` project on the .NET 11 RC2 SDK with `Microsoft.Maui.Controls` 10.0.130, the define and `EnablePreviewFeatures=true` fails with CA2252. With the patched `Microsoft.Maui.Controls.SourceGen.dll` swapped in, it builds. **.NET 11 / main:** no change needed. The generator no longer emits the attribute (#33834), and the attribute is `[Obsolete]` instead of preview-gated. `Microsoft.Maui.Controls` 11.0.10 builds cleanly with the same settings on both `net11.0` (with `GenerateRequiresPreviewFeaturesAttribute=false`) and `net10.0`. ### Issues Fixed Fixes #40045 ---------
This comment has been minimized.
This comment has been minimized.
| <!-- Used by Maui40045Tests to run the CA2252 analyzer over generated code --> | ||
| <Target Name="_AddNetAnalyzersPathMetadata" BeforeTargets="GetAssemblyAttributes" DependsOnTargets="ResolveLockFileAnalyzers"> | ||
| <ItemGroup> | ||
| <AssemblyMetadata Include="NetAnalyzersPath" Value="%(Analyzer.FullPath)" Condition="'%(Analyzer.Filename)' == 'Microsoft.CodeAnalysis.NetAnalyzers'" /> |
There was a problem hiding this comment.
[moderate] Build & MSBuild - This embeds the build machine's absolute analyzer path into the test assembly. eng/helix.proj includes this project in unit-test payloads sent to Windows and macOS workers, where the original SDK/NuGet path is unavailable. Maui40045Tests.GetPreviewFeaturesAnalyzers passes that embedded path directly to AnalyzerFileReference, so the new test fails while loading the analyzer instead of checking CA2252. The correlation payloads do not remap that path. Copy the required analyzer assemblies into the test payload and resolve them relative to the test assembly.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…0339) <!-- 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. !!!!!!! --> ### Description of Change Backport of #40199 to `release/10.0.1xx-sr14` (SR14 / 10.0.140, tracking PR #40222), as requested in #40199 (comment). `WeakCommandSubscription.CommandCanExecuteSubscription` now keeps a `WeakReference<BindableObject>` to the target and resolves it before invoking the handler. A `DependentHandle` can still expose a finalization-reachable target after its binding weak references have been finalized; notifying that target caused the crash. When the target is gone, the subscription disposes itself. Cost: one weak reference per subscription. Clean cherry-pick of 0088a35 (no conflicts). Validation on the SR14 base (72615b7) with SDK 10.0.113-servicing.26454.107 (from `global.json`), `net10.0`, mobile TFMs disabled: - `dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter "FullyQualifiedName~CommandTests|FullyQualifiedName~WeakCommand"` → passed 48/48 - `CanExecuteDoesNotRefreshCollectedButtonBindings` with production change reverted → failed 3/3; restored → passed 3/3 - Full `Controls.Core.UnitTests` → passed 5966, skipped 30, failed 0 Not run: customer-app validation and Android/iOS runtime validation. ### Issues Fixed Fixes #40198 Co-authored-by: Timothy Sturm <timothysturm@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
PR Test Gate🧪 Gate analysis — click to expand✅ Passed. The selected verification satisfied the gate's passing conditions. Unmatched, skipped, or inconclusive groups are not passing evidence. 🧪 Unit tests
Execution log excerptsWithout fix With fix Without fix With fix PR head: 23c83479. Without-fix baseline: 54d76458. |
There was a problem hiding this comment.
Expert Review — 1 finding
Reviewed commit 23c8347.
Previously reported findings were not duplicated.
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis🧪 CI Analysis — click to expand📊 maui-pr
🧪 maui-pr-devicetestsNo failures found. 🧪 maui-pr-uitests
🧭 Follow-up — actions and refreshNext action: Make analyzer assets portable; compare unresolved cases using identical base/head setups and restore missing diagnostics.
|
…ow in WillTerminate (#40554) Backport of #40452 to .NET 10 servicing. Fixes #40438 for .NET 10. The iOS 27 SDK makes the UIScene lifecycle mandatory, so every .NET 10 MAUI iOS app built with Xcode 27 needs a UIApplicationSceneManifest. Apps that still set Application.MainPage then crash with "InvalidOperationException: Window was already destroyed" on every force-close from the app switcher: SceneDidDisconnect destroys the window, the destroyed MainPage window stays in Application.Windows, and the WillTerminate handler destroys it again. Seen in production crash reports of a shipping .NET 10 app (MAUI 10.0.110, iOS 27.2.1). Changes (cherry-picked from #40452): - WillTerminate only destroys a window whose handler is still connected (Destroying() disconnects it), so a window the scene already destroyed is skipped; a terminate without a prior scene disconnect still destroys the window. - WindowTests.WillTerminateDestroysMainPageWindowOnce (iOS / Mac Catalyst device test), both with and without a prior scene disconnect. The test file had a .NET 11 only test in the original PR; in release/10.0.1xx-sr14 the iOS WindowTests partial was empty, so only the new test and its stub were added. --------- Co-authored-by: Mykhailo Davydenko <davudenko.mukhailo@gmail.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — 1 finding
Reviewed commit a7e0612.
Previously reported findings were not duplicated.
…ermination (#40589) <!-- 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. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Backports #40310 to .NET MAUI 10 SR14. When WebKit terminates a WebView content process, the navigation delegate raises `ProcessTerminated` and reloads the current page or HTML source. Automatic reloads are limited to once every 30 seconds to prevent a reload loop. **Validation:** On an iOS 18.5 simulator, the three new WebView regression tests failed on the unfixed SR14 baseline and passed in two runs with the combined Shell and WebView backports. The split WebView branch built successfully for the iOS simulator; its separate test run was stopped before completion. ### 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. --> Backports the fix for #39973. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
<!-- 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. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Backports #40221 to .NET MAUI 10 SR14. On iOS and Mac Catalyst 18+, the Shell renderer mirrors an opaque, solid page background onto the native tab controller during tab switches and restores its previous background when appropriate. The newer Shell handler is not present in .NET 10, so this backport covers the renderer only. **Validation:** On an iOS 18.5 simulator, the three new Shell regression tests failed on the unfixed SR14 baseline and passed in two runs with the combined Shell and WebView backports. An unrelated `ShellTests.TitleViewConstraints` test failed on both the baseline and fixed runs. The split Shell branch built successfully for the iOS simulator; its separate test run was stopped before completion. ### 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. --> Backports the fix for #39800. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — 8 findings · ⚠️ 1 breaking change
Reviewed commit 25c4d78.
Warning
Existing apps would look or behave differently without opting in. See the Behavioral Change Disclosure findings at:
See inline comments for details.
| state.Overridden = true; | ||
| } | ||
|
|
||
| view.BackgroundColor = color.ToPlatform(); |
There was a problem hiding this comment.
[major] Behavioral Change Disclosure - On iOS/Mac Catalyst 18+, a custom ShellRenderer can set its ShellItemRenderer.View.BackgroundColor to a deliberate transition backdrop. Previously that color survived tab switches; now switching between opaque solid-colored pages overwrites it with each page's color. Capturing the previous color only restores it when a page stops qualifying, so it does not preserve this working customization. Make background mirroring an explicit opt-in for this servicing target, keeping the previous backing-view behavior by default.
| <!-- Used by Maui40045Tests to run the CA2252 analyzer over generated code --> | ||
| <Target Name="_AddNetAnalyzersPathMetadata" BeforeTargets="GetAssemblyAttributes" DependsOnTargets="ResolveLockFileAnalyzers"> | ||
| <ItemGroup> | ||
| <AssemblyMetadata Include="NetAnalyzersPath" Value="%(Analyzer.FullPath)" Condition="'%(Analyzer.Filename)' == 'Microsoft.CodeAnalysis.NetAnalyzers'" /> |
There was a problem hiding this comment.
[moderate] Build & MSBuild - This embeds the build machine's absolute analyzer path into the test assembly. eng/helix.proj sends this project to Windows and macOS workers, but its correlation payloads do not recreate or remap that SDK/NuGet location. Maui40045Tests.GetPreviewFeaturesAnalyzers passes the embedded path directly to AnalyzerFileReference and throws on analyzer-load failure, so the relocated test fails before checking CA2252. Copy the required analyzer assemblies into the test payload and resolve them relative to the test assembly instead.
| if (handler is null || !handler.IsConnected() || handler.VirtualView is not IWebView virtualView) | ||
| return; | ||
|
|
||
| virtualView.ProcessTerminated(new WebProcessTerminatedEventArgs(webView)); |
There was a problem hiding this comment.
[moderate] Handler Mapper and Property Patterns - Check handler.PlatformView == webView before raising ProcessTerminated. Disconnect leaves the old WKWebView's navigation delegate attached; reconnecting the same handler creates a new native view. If the retained old view then reports process termination, IsConnected succeeds and this line delivers the old view's event to the newly attached virtual view. The identity check afterward prevents a reload but cannot undo the incorrect application notification. Cover reconnecting a handler while its old native view remains alive.
| virtualView.ProcessTerminated(new WebProcessTerminatedEventArgs(webView)); | ||
|
|
||
| // The app's ProcessTerminated handler may have disconnected the handler or swapped its views. | ||
| if (!handler.IsConnected() || handler.VirtualView != virtualView || handler.PlatformView != webView) |
There was a problem hiding this comment.
[moderate] iOS/macCatalyst Platform Specifics - A ProcessTerminated subscriber can set Source to fallback HTML with a different BaseUrl without replacing the handler or either view. LoadHtml updates HtmlUrl synchronously, but WKWebView.Url still represents the previously committed page until the replacement navigation commits. This guard allows recovery to continue, and the URL mismatch below calls Reload on the old page, superseding the subscriber's replacement load. Track source/navigation changes across the event and skip automatic recovery when the subscriber has already started a load; add that reentrant recovery case.
| LastProcessTerminationReload = now; | ||
|
|
||
| // Restore an HTML source only while its document is shown; a page the user moved on to reloads itself. | ||
| if (webView is MauiWKWebView { HtmlUrl: { } htmlUrl } && webView.Url?.AbsoluteString?.Split('#')[0] is { } url && url != htmlUrl) |
There was a problem hiding this comment.
[moderate] iOS/macCatalyst Platform Specifics - A different URL does not necessarily mean the injected HTML document was left. HTML using the default bundle base can call history.replaceState(null, '', '?route=details') without loading another document. Following process termination, the changed query makes this condition choose native Reload instead of supplying the in-memory HTML again, so recovery attempts a file URL rather than restoring the document. Track document-changing navigation separately from same-document URL changes and cover query-state changes on an HTML source; the current fragment test uses a URL source.
| if (webView is MauiWKWebView { HtmlUrl: { } htmlUrl } && webView.Url?.AbsoluteString?.Split('#')[0] is { } url && url != htmlUrl) | ||
| webView.Reload(); | ||
| else | ||
| webView.UpdateReload(virtualView); |
There was a problem hiding this comment.
[moderate] Logic and Correctness Verification - HTML recovery misses subclasses such as CustomHtmlSource : HtmlWebViewSource. The inherited Load method supplies HTML and sets HtmlUrl normally, so termination on that document reaches UpdateReload here. However, that helper recognizes HTML only when Source.GetType().Name equals "HtmlWebViewSource"; a subclass takes native Reload instead of supplying its HTML, retaining the blank-content failure. Base recovery on the source's loading behavior rather than its exact type name, and add a derived-HTML-source case.
| { | ||
| // A page with Opacity < 1 is meant to show what is behind it, so its | ||
| // background must not be mirrored onto the opaque backing view. | ||
| if (!OperatingSystem.IsIOSVersionAtLeast(18) && !OperatingSystem.IsMacCatalystVersionAtLeast(18)) |
There was a problem hiding this comment.
[moderate] Regression Prevention and Test Coverage - This transparency test changes Page.Opacity while its background stays fully opaque, so it never exercises the independent color.Alpha rejection in UpdateTabSwitchBackground. Removing that rejection leaves all three tests satisfied. Add a case with Page.Opacity = 1 that changes an opaque BackgroundColor to a partially transparent color and asserts restoration of the captured backing color. This distinguishes color alpha from page opacity and protects against compositing a translucent page over another copy of its background.
| var terminated = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); | ||
| webView.Navigated += (_, e) => navigated.TrySetResult(e.Result); | ||
| webView.ProcessTerminated += (_, _) => terminated.TrySetResult(); | ||
|
|
There was a problem hiding this comment.
[moderate] Regression Prevention and Test Coverage - The only ProcessTerminated subscriber merely signals completion, so none of these tests exercises the new post-event disconnect guard. Add a case whose subscriber disconnects the handler, asserting that notification occurs but recovery does not reload or access the disconnected view. All current recovery/cooldown tests keep the same handler connected and would accept removal of that guard, leaving this explicitly supported reentrant lifecycle case unprotected.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Draft tracking PR for .NET MAUI 10 SR14 (10.0.140):
release/10.0.1xx-sr14→release/10.0.1xx-sr13.main,net11and the inflight lanes are now .NET 11, so the .NET 10 SR14 line was cut from the SR13 release head (54d76458e0). .NET 10 fixes for SR14 should targetrelease/10.0.1xx-sr14; this PR shows the accumulated SR14 delta over SR13.Content:
[XSG]CA2252 suppression on generatedAllowImplicitXmlnsDeclaration(Build Error Using Implicit XAML Namespaces #40045).Keep in draft. This PR does not tag, publish, or authorize a release; the internal dnceng mirror of
release/10.0.1xx-sr14has not been created.Issues Fixed
N/A – SR14 release tracking; individual fixes are linked in their PRs.