Repository navigation
Conversation
Updated [Microsoft.AspNetCore.Authentication.Facebook](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.10. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.Facebook's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.AspNetCore.Authentication.Google](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.10. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.Google's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.AspNetCore.Authentication.MicrosoftAccount](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.10. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.MicrosoftAccount's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- 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 #37534 ### 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/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37772) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> The issue was caused by a small view moved off-screen with TranslationY for a full-screen Shell navigation animation. This incorrectly preserved the top safe-area inset, creating the unwanted gap in the bottom sheet. https://github.com/dotnet/maui/blob/19a188896c0e518c0d201db181f67166c740724d/src/Core/src/Platform/Android/SafeAreaExtensions.cs#L175 On Android, moving a view outside the screen using TranslationY incorrectly adds top padding to the layout. <!-- Enter description of the fix in this section --> Updated Android vertical animation detection to treat only full-screen views as Shell navigation transitions. Smaller translated controls, are excluded so they no longer receive incorrect top safe-area padding. <!-- 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 #37418 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [ ] Windows - [x] iOS - [ ] Mac | Before | After | |---------|--------| | **Android**<br> <img src="https://github.com/user-attachments/assets/9a17e25d-4b59-4d33-9b22-014bb504e3a0" width="300" height="600"> | **Android**<br> <img src="https://github.com/user-attachments/assets/aef1bf14-dca6-411f-94e4-c473ac3b5d0c" width="300" height="600"> | --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
…8587) <!-- 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 with Material 3, an Editor starts at its maximum height instead of growing as text is entered. ### Root Cause The Editor was forced to use all available height, changing MaximumHeightRequest from a limit into its starting height. ### Description of Change Force the available height only for single-line controls such as Entry, allowing the multiline Editor to grow with its content. Validated the behavior in the following platforms - [x] Android - [ ] Windows - [ ] iOS - [ ] Mac ### Issues Fixed Fixes #37440 ### Output ScreenShot |Before|After| |--|--| | <img width="363" height="657" alt="image" src="https://github.com/user-attachments/assets/3dc925f8-5621-44d7-95ea-39b9e3bdd19b" /> | <img width="363" height="657" alt="image" src="https://github.com/user-attachments/assets/e085a680-f78c-4ce3-8f83-351569155f74" /> |
Updated [Microsoft.AspNetCore.Authentication.Facebook](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.13. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.Facebook's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.AspNetCore.Authentication.Google](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.13. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.Google's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.AspNetCore.Authentication.MicrosoftAccount](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.13. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.MicrosoftAccount's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details>
<!-- 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 SwipeItemView was retained by a long-lived command through its CanExecuteChanged event, causing a memory leak. ### Description of Change <!-- Enter description of the fix in this section --> Replaced the direct event subscription with MAUI’s existing WeakCommandSubscription through ICommandElement. ### 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 #38177 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <img src="https://github.com/user-attachments/assets/0ed1f34f-f4c2-45be-88e5-430f417fcdb9" width="300" height="600"> | **Android**<br> <img src="https://github.com/user-attachments/assets/e656958b-c414-4fbf-b4d0-a6498a8375de" width="300" height="600"> | --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Some refactor and improve the error message for XAML SG. ### 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 #38711 <!-- 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! ### Issue Details - Assigning a shared or long-lived TransformCollection to TransformGroup.Children creates a strong CollectionChanged event subscription that keeps the TransformGroup and its binding context alive even after all application references to the group are dropped, causing a memory leak. ### Root Cause - A shared TransformCollection strongly retained its TransformGroup through the CollectionChanged event subscription when Children was never replaced. ### Description of Change - The collection subscription now uses a weak proxy with deterministic and finalizer cleanup, preventing a shared collection from retaining an unreferenced TransformGroup. - Updated the public API files to reflect the addition of a finalizer (~TransformGroup) for TransformGroup on all supported platforms. ### Issues Fixed Fixes #38717 ### Validated the behaviour in the following platforms - [x] Windows - [x] Android - [x] iOS - [x] Mac ### Output | Platform | Before | After | |----------|----------|----------| | iOS | <img src="https://github.com/user-attachments/assets/adb67d0b-c8eb-4cb9-bf55-a8cb51788308"> | <img src="https://github.com/user-attachments/assets/e314e0e5-25a8-440d-87f4-08e578c1efe2"> | | Android | <img src="https://github.com/user-attachments/assets/d5dcfd77-fbbd-4938-b0fd-c64111242aa8"> | <img src="https://github.com/user-attachments/assets/b57dd07a-8c82-4e85-bf50-0b2f48718b69"> | | Mac | <img src="https://github.com/user-attachments/assets/f14456fd-edb9-4372-8723-4badbbf52c29"> | <img src="https://github.com/user-attachments/assets/d811ec05-3eb0-42b2-8f63-1ad069a6c50a"> | | Windows | <img src="https://github.com/user-attachments/assets/20234ae5-e7d7-4489-ab7c-cf41c4e07067"> | <img src="https://github.com/user-attachments/assets/849a3828-4b1b-4c59-8e66-f5d2977048bb"> |
…ggers attached (#38439) <!-- 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 Clearing an attached VisualStateGroupList removes groups without detaching the state triggers nested inside them. A trigger subscribed to a shared managed publisher in OnAttached() therefore stays subscribed and retained after its group is removed. ### Root Cause An attached `StateTriggerBase` runs `OnAttached()`, where custom triggers may subscribe to long-lived publishers such as static events. They rely on `SendDetached()` invoking `OnDetached()` to unsubscribe. Replacing the entire `VisualStateGroups` attached property already performed this teardown. However, mutating the existing `VisualStateGroupList` did not: - `Clear` - `Remove` - `RemoveAt` - Adding a group that replaces one with the same name - Replacing a group through the indexer These paths only removed `StatesChanged` handlers and collection entries. Nested triggers remained attached, leaving retention paths such as: ```text static publisher → event delegate → state trigger → page-local data ``` ### Description of Change Added a shared `DetachGroup` teardown method that: 1. Unsubscribes the group's `StatesChanged` handler. 2. Calls `SendDetached()` on every nested state trigger. 3. Removes the group's reference to its associated visual element. All removal and replacement paths in `VisualStateGroupList` now use this teardown. The `Remove` implementation also identifies the actual stored group before removing it. This ensures the correct instance is detached even when another equality-equivalent object is supplied. ## Regression coverage Added tests to `VisualStateManagerTests.cs` verifying trigger detachment for: - `Clear` - `Remove` - `RemoveAt` - Duplicate-name replacement through `Add` - Index replacement ### Issues Fixed Fixes #38245 **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | <img width="300" height="600" alt="image" src="https://github.com/user-attachments/assets/3f5ede16-f0ee-4aac-b728-07835001f851" /> | <img width="300" height="600" alt="image" src="https://github.com/user-attachments/assets/dafc0ce1-e9b4-439d-949e-cbe29a29af49" /> | --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… device rotation (#38771) <!-- 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. !!!!!!! --> ### Root cause The issue occurs because of the cell being arranged too early during the preferred layout pass when the collection view constraints change during device rotation. This updates the cached arranged size before LayoutSubviews receives the final native bounds, which can cause the layout to skip the required final arrangement and result in incorrect item positioning or sizing in RTL layouts. ### Solution description The fix involves deferring the arrangement to LayoutSubviews when the layout constraints change, such as during device rotation, so the cell can be arranged using the actual native bounds. At the same time, inline arrangement is retained for dynamic content changes to preserve the behavior introduced by the existing CollectionView2 dynamic content fix. ### Regression PR PR #37437 Validated the behavior in the following platforms - [x] iOS - [ ] Mac - [ ] Android - [ ] Windows ### Issues Fixed Fixes #38622 ### Output ScreenShot |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/4c2b5c8f-fd29-40b0-a8f3-5063684dc6fd">| <video src="https://github.com/user-attachments/assets/948ef0eb-f31d-47e7-b7a9-509a54680f16">|
…t truncates to 0 (#38814) <!-- 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 - GeometryHelper can generate invalid `(NaN, NaN)` points when flattening very small arc, cubic Bézier, or quadratic Bézier segments. - On Windows, these invalid points can propagate into the Win2D geometry pipeline and cause `D2DERR_BAD_NUMBER (0x88990011)`, which may terminate the application. - On Android, the invalid path typically results in the shape not being rendered. ### Root Cause - The flattening algorithms calculate a subdivision count based on the estimated curve length and the specified tolerance. - When the curve length is smaller than the tolerance, integer truncation causes the calculated subdivision count to become `0`. - The flattening loop still executes once and subsequently uses the subdivision count as a divisor. - This results in a `0.0 / 0.0` calculation, producing `NaN`. - The resulting non-finite point is added to the flattened geometry and propagated to platform rendering. ### Description of Change #### Geometry flattening robustness improvements - Updated `FlattenCubicBezier`, `FlattenQuadraticBezier`, and `FlattenArc` in `GeometryHelper.cs` to ensure the calculated subdivision count is never less than `1`. - This prevents division-by-zero during interpolation and eliminates generation of `(NaN, NaN)` points for sub-tolerance curves. - Very small curves are now flattened into the smallest valid approximation: a single straight chord between the start and end points. **Unit test enhancements:** * Added new tests in `GeometryTests.cs` (`FlattenSmallArcProducesFinitePoints`, `FlattenSmallCubicBezierProducesFinitePoints`, and `FlattenSmallQuadraticBezierProducesFinitePoints`) to verify that flattening small arcs and beziers always results in a finite set of valid points, specifically checking for exactly two points and that all coordinates are finite. ### 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 #38751 ### Tested the behavior in the following platforms - [x] Windows - [x] Android - [ ] iOS - [ ] Mac ### Output | Before | After | |----------|----------| | <img src="https://github.com/user-attachments/assets/a9c65c2e-951a-4ada-9d7a-f0785f4395b4"> | <img src="https://github.com/user-attachments/assets/5929a257-c62b-4da0-9189-a737bbf0a052"> | <!-- 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. !!!!!!! --> ### Issue Details AddHandler can cause IMauiHandlersCollection objects and their registered services to stay in memory, resulting in a memory leak. ### Root Cause A static ConcurrentDictionary keeps the handler collection as a strong reference, so it cannot be garbage-collected. ### Description of Change Replaced ConcurrentDictionary with ConditionalWeakTable in RegisteredHandlerServiceTypeSet to ensure that IMauiHandlersCollection instances can be garbage collected when no longer referenced, reducing the risk of memory leaks. Validated the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes #38671 ### Output ScreenShot |Before|After| |--|--| | <img width="700" height="284" alt="image" src="https://github.com/user-attachments/assets/d31d91b4-02a3-4317-8f45-dfda2ade95a0" /> | <img width="700" height="284" alt="image" src="https://github.com/user-attachments/assets/cd5d50a3-3808-4630-80b2-c9e5237593e8" /> |
…r removed (#38550) <!-- 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 Removing a VisualState from VisualStateGroup.States does not properly detach its triggers. If a trigger is subscribed to a long-lived event, it can remain subscribed even after the state is removed. This can keep the trigger and its referenced objects alive and cause objects to be retained. The issue can occur with operations such as Clear(), Remove(), RemoveAt(), and state replacement. ### Root Cause VisualStateGroup.States previously used WatchAddList<VisualState>, which did not provide callbacks for individual state removal. As a result, removing a state did not detach its triggers or clear the state's VisualStateGroup reference. This could leave trigger event subscriptions active and prevent the trigger and its referenced objects from being garbage-collected. ### Description of Change Updated the VisualState collection handling to support individual state addition and removal callbacks. - Attach triggers when a VisualState is added to an existing VisualStateGroup. - Detach triggers when a VisualState is removed. - Unapply the active state before removing it and clear CurrentState. - Clear the removed state's VisualStateGroup reference. - Attach triggers for existing states when a VisualStateGroup is added to an attached element. - Detach triggers and clear the group association when a VisualStateGroup is removed. This ensures that VisualState triggers are correctly attached and detached throughout the state and group lifecycle and prevents trigger event subscriptions from keeping removed states and referenced objects alive. ### Issues Fixed Fixes #38244 ### Output |Before|After| |--|--| | <img width="1200" height="400" alt="image" src="https://github.com/user-attachments/assets/42f48169-1fc7-41e5-9f1e-bbc65551843c" /> | <img width="700" height="210" alt="image" src="https://github.com/user-attachments/assets/417f0517-3235-4a47-960e-cea352efa278" /> | --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.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! ### Issue Details When multiple PathFigure instances use the same PathSegmentCollection, the CollectionChanged event subscription can keep the PathFigure instances alive even after they are no longer referenced. This can prevent the PathFigure objects from being garbage collected and may result in increasing memory usage when this scenario occurs repeatedly. ### Description of Change <!-- Enter description of the fix in this section --> * Added WeakNotifyCollectionChangedProxy to manage PathSegmentCollection.CollectionChanged subscriptions using a weak reference. * Updated PathFigure finalization to unsubscribe the collection proxy when the PathFigure is finalized. * Updated the collection subscription and unsubscription logic to use the proxy. ### 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 #38718 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/c3a742a8-a8c8-4cec-a5d4-b2340fbe179a" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f00c73ee-25ae-42f6-a0ad-23a5efd407d3" width="300" height="600"> |
<!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request updates the way `ImageSourceToImageSourceServiceTypeMapping` manages its mapping between `IImageSourceServiceCollection` instances and their corresponding service type mappings, switching from a strong reference dictionary to a weak reference table. This change is designed to allow for proper garbage collection of service collections when they are no longer in use, preventing memory leaks. A new unit test is also added to verify that service collections can be collected by the garbage collector. **Memory management improvements:** * Replaced `ConcurrentDictionary` with `ConditionalWeakTable` in `ImageSourceToImageSourceServiceTypeMapping` to ensure that `IImageSourceServiceCollection` instances can be garbage collected when no longer referenced, reducing the risk of memory leaks. **Testing enhancements:** * Added a unit test `RegisteredImageSourceServiceCollectionCanBeCollected` to verify that `IImageSourceServiceCollection` instances registered with the mapping can be garbage collected, confirming the effectiveness of the weak reference approach. * Introduced helper classes (`TestImageSource`, `TestImageSourceService`, `TestImageSourceServiceCollection`) in the test file to support the new garbage collection test. **Dependency updates:** * Added `System.Runtime.CompilerServices` and `Microsoft.Maui.Hosting.Internal` namespaces to the test file to support the use of `ConditionalWeakTable` and internal hosting features. <!-- 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 #38670 ### Tested the behavior in the following platforms - [x] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="735" height="391" alt="Screenshot 2026-09-21 at 18 49 36" src="https://github.com/user-attachments/assets/f00346e4-69a7-4453-9952-5ef717586d74" /> | <img width="746" height="366" alt="Screenshot 2026-09-21 at 18 50 02" src="https://github.com/user-attachments/assets/42fd3a23-0e0a-4cbf-820a-5bf6abb43725" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…r leaves views rooted (#38657) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request introduces a new unit test to detect and prevent memory leaks in the hot reload system, and it also updates the logic in the `UnRegister` method to ensure proper cleanup of registered views, even when hot reload is disabled. These changes help ensure that memory is managed correctly during hot reload operations and that no unnecessary references are retained. ### Description of Change **Hot reload system behavior:** * Updated the `UnRegister` method in `HotReloadHelper.cs` to always remove the view from `currentViews`, regardless of whether hot reload is enabled, preventing potential memory leaks when unregistering views while hot reload is disabled. **Testing and memory management improvements:** * Added a new test `HotReloadLeakTest` in `HotReloadLeakTest.cs` to verify that the hot reload system does not leak memory by retaining references to payloads after views are unregistered, covering control, leaky, and mitigation scenarios. <!-- 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 #38351 ### Tested the behavior in the following platforms - [x] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="725" height="400" alt="Screenshot 2026-09-18 at 16 23 38" src="https://github.com/user-attachments/assets/c3d87ded-eaf2-4f22-9e2a-cb4ca23e2c84" /> | <img width="716" height="308" alt="Screenshot 2026-09-18 at 16 22 56" src="https://github.com/user-attachments/assets/69c362a3-eeaa-433d-8319-6ead28502606" /> | <!-- 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! ### Issue Details - On Android with Material 3 enabled, the Shell TabBar and TabbedPage selection colors do not update when the application theme changes. ### Root Cause - On Android Material 3, TabbedPage's BottomNavigationView.ItemActiveIndicatorColor was not updated when the application theme changed, causing the tab selection indicator to retain the previous theme's color. ### Description of Change - Added UpdateActiveIndicatorColor to BottomNavigationViewUtils to update BottomNavigationView.ItemActiveIndicatorColor based on the current application theme, ensuring the TabBar selection indicator uses the correct color after a theme change. - Integrated UpdateActiveIndicatorColor into ShellItemRenderer and TabbedPageManager so the TabBar selection indicator is refreshed when the appearance changes. - Subscribed and unsubscribed to Application.Current.RequestedThemeChanged in TabbedPageManager to refresh the TabbedPage selection indicator when the application theme changes. ### Issues Fixed Fixes #38234 ### Validated the behaviour in the following platforms - [ ] Windows - [x] Android - [ ] iOS - [ ] Mac ### Output | Before | After | |----------|----------| | <video src="https://github.com/user-attachments/assets/297ade85-9f14-4e31-9fb6-bc59cc8bce6f">| <video src="https://github.com/user-attachments/assets/f0f82993-dc89-4dbd-bdc4-e0aeb89cd820"> | --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ps (#38850) ### Description of Change Two stale facts in the Helix section of `docs/DevelopmentTips.md`: - It lists `eng/pipelines/common/stage-device-tests.yml` as the pipeline template; that file doesn't exist. The template is `eng/pipelines/arcade/stage-device-tests.yml` (used by `eng/pipelines/device-tests.yml` and `ci-device-tests.yml`). - It gives iOS and Mac Catalyst the queue `osx.15.arm64.Open`, but `eng/helix_xharness.proj` sets `osx.15.arm64.maui.open;osx.26.arm64.open` for both. Android already matches. Docs-only. AI assistance: found and prepared with Claude Code; I checked both against the files in `eng/` before opening. ### Issues Fixed None, small docs fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Missy Messa <47990216+missymessa@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nstead of their measured width on Android, iOS, and macOS (#38271) <!-- 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 The SwipeMenuItems were rendered to the full width of the SwipeView instead of their measured width on Android, iOS, and macOS. ### Root Cause On both platforms, `GetSwipeItemSize` for `ISwipeItemMenuItem` in `Execute` mode never measured the native menu control's rendered content — Android and iOS divided `contentWidth` by `items.Count` (full content width with a single item). ### Description of Change Now the GetSwipeItemSize is measures the native button (`SizeThatFits` on iOS, `MeasureSpec.AtMost` on Android), converts to DIP/points. ### Issues Fixed Fixes #37839 **Tested the behavior in the following platforms.** - [x] Android - [ ] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | <Video src="https://github.com/user-attachments/assets/d1112adf-74a7-4f5d-9f43-12f22be0b11b" Width="300" Height="600" /> | <Video src="https://github.com/user-attachments/assets/9ee4bbb1-8b4a-4813-acd5-7d79d8fb2981" Width="300" Height="600" /> |
<!-- 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 - PathFigureCollection keeps a strong reference to the discarded PathGeometry through its CollectionChanged handler, preventing garbage collection and resulting in a memory leak. ### Root Cause - PathGeometry subscribed directly to PathFigureCollection.CollectionChanged, allowing a shared collection to strongly retain the geometry through its event delegate. ### Description of Change - Replaced the strong collection event subscription with WeakNotifyCollectionChangedProxy, retained deterministic unsubscription when Figures changes, added finalizer cleanup, and added a regression test verifying that a shared collection does not retain PathGeometry. ### Issues Fixed Fixes #38686 ### Validated the behaviour in the following platforms - [x] Windows - [x] Android - [x] iOS - [x] Mac ### Output | Platform | Before | After | |----------|----------|----------| | iOS | <img src="https://github.com/user-attachments/assets/fb3c32f9-6b9e-4ea0-a28c-4dead1946bbc"> | <img src="https://github.com/user-attachments/assets/184f5f15-8780-4b82-a9af-da602f7812d5"> | | Android | <img src="https://github.com/user-attachments/assets/d207a69b-65aa-4fc7-8670-3b23a9fb951e"> | <img src="https://github.com/user-attachments/assets/700261b7-51f1-427e-acdf-86fa23fd78a3"> | | Mac | <img src="https://github.com/user-attachments/assets/eadd0622-cb53-43ba-a3a5-760685d16b3e"> | <img src="https://github.com/user-attachments/assets/7ea16dab-0f13-4fe1-ba70-0e80fcbd4dbb"> | | Windows | <img src="https://github.com/user-attachments/assets/fafec7fd-0036-4d21-9f64-85f614cf3e02"> | <img src="https://github.com/user-attachments/assets/f55e9e6a-2807-4e9a-8076-6691b2ad07fc"> |
<!-- 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 Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…acingItemDecoration + ObservableGroupedSource) (#38969) > [!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! On Android, a `CollectionView` with `GridItemsLayout` blocks the UI thread for tens of seconds (and ANRs on fling) once the item count reaches a few thousand. Assigning 10 000 grouped items: 94 ms on 10.0.90 → ~40 s on 10.0.100+. Ungrouped grids regressed ~12× and stutter on fling. Independently, `ScrollTo` a far group in a grouped grid took ~38 s for 10 000 items on every version. 1. #35782 changed `SpacingItemDecoration.GetItemOffsets` to call `SpanSizeLookup.GetSpanGroupIndex(itemCount - 1)` for **every cell on every layout pass**. That is the uncached AndroidX API: it iterates `getSpanSize()` (a JNI round-trip into `GridLayoutSpanSizeLookup`) over every position between the nearest cached key and the target — O(n) per cell. #38341 later fixed a crash on this path but not the cost. 2. `ObservableGroupedSource.GetGroupAndIndex` stepped one position at a time (O(position)). It is reached from `GetItemViewType` for every span-size query, so grouped grids paid O(n²) and any `ScrollTo` to an uncached region was quadratic. - `SpacingItemDecoration`: return early when both offsets are 0; decide first/last row by inspecting only the ≤ spanCount items that can share the row, starting from the span index `GridLayoutManager` already assigned to the child (`LayoutParams.SpanIndex`, falling back to `GetSpanIndex`). Output is unchanged. - `ObservableGroupedSource.GetGroupAndIndex`: walk groups with live counts (O(groups)). Live counts are required because `ReorderableItemsViewAdapter.OnItemMove` mutates groups with `ObserveChanges` disabled. Empty groups without a header are now resolved correctly (the old loop returned the empty group's index for the next group's first item) and out-of-range positions no longer index past `_groups`. Not in this PR (follow-up candidate for #38926): overriding `GetSpanIndex`/`GetSpanGroupIndex` in `GridLayoutSpanSizeLookup` so that `GridLayoutManager` itself never walks `getSpanSize` across JNI for uncached positions (ungrouped up-scroll after a jump still shows this). HostApp `Issue38925` page (50 groups × 200 items, `Span=4`, spacing 4), Release, HONOR PGT-N19 / Android 16. "UI thread blocked" measured from the action until a `Dispatcher.Dispatch` callback runs. | Step | `main` before | `main` with this PR | |---|---|---| | Set `ItemsSource` | 59 683 ms | **110 ms** | | `ScrollTo` last group | 131 839 ms | **678 ms** | | `ScrollTo` first group | 57 693 ms | **105 ms** | | Before (4× speed) | After | |---|---| | <video src="https://github.com/user-attachments/assets/dcb43c20-c088-4784-ad63-e921fa4d0ecb" width="300"> | <video src="https://github.com/user-attachments/assets/46baf477-5262-4c4e-9fcd-85976022dd65" width="300"> | Rendering verified unchanged: pixel-identical screen-recordings of the grid region before/after on the same device; `Issue35700`'s existing snapshot test covers grouped-grid spacing in CI. - `TestCases.HostApp/Issues/Issue38925.cs` + `TestCases.Shared.Tests/Tests/Issues/Issue38925.cs` (Android): load 10 000 grouped items, `ScrollTo` end and start; each must complete within the default wait. Fails before the fix (every step > 15 s), passes after. - `DeviceTests/.../CollectionViewTests.Android.cs`: `GroupedSourceGetGroupAndIndexMatchesGroupContents` — 16 header/footer/group-header/group-footer combinations, including an empty group, checked against a brute-force reference. Fixes #38925 Fixes #38926 - [x] Android - [ ] iOS (not applicable — Android handler only) - [ ] Mac (not applicable) - [ ] Windows (not applicable)
… fix a crash in -[UIView dealloc] on iOS 17 (#38662) **TL;DR** — On iOS 17 and older, a managed KVO observer (`NSObject.AddObserver(key, options, Action)`) that is garbage-collected while still registered leaves a dangling pointer in the observed object's KVO registry, and the next notification crashes the app — typically `-[UIView dealloc]` under the `NSObject_Disposer` drain. `ViewExtensions.OnLoaded` registered such observers on the layer of every platform view without `IUIViewLifeCycleEvents` and kept them until the view loaded, so views that never reach a window crashed later. This PR replaces every managed KVO registration in MAUI with a Swift-owned observation (`MauiKeyValueObserver` in the AppleNative interop, wrapped by an internal `KeyValueObservation` facade) whose registration cannot outlive its observer, makes `PlatformTouchGraphicsView` raise `MovedToWindow` itself so `GraphicsView` never takes the fallback, and fixes the device-test collection helper so the `Memory` suite is green on iOS 17.5 too. No public API change except the `MovedToWindow` override. ### Description of Change #### The crash Reported from a production app on iPhone 15 / iOS 17.5 (arm64), and reproduced byte-for-byte on an iOS 17.5 simulator by the new device test on the unmodified code: ``` EXC_BAD_ACCESS KERN_INVALID_ADDRESS libobjc.A.dylib class_getMethodImplementation Foundation _NSKVONotifyingOriginalClassForIsa Foundation _NSKeyValueObservationInfoGetObservances Foundation NSKeyValueWillChangeWithPerThreadPendingNotifications QuartzCore CA::Layer::begin_change QuartzCore CA::Layer::set_delegate UIKitCore -[UIView dealloc] libxamarin-dotnet xamarin_release_managed_ref <app> +[__NSObject_Disposer drain:] Foundation __NSThreadPerformPerform CoreFoundation __CFRunLoopDoSource0 ... ``` The original report named `-[PlatformGraphicsView release]`, i.e. a `GraphicsView` being released by the garbage collector's disposer. #### Root cause The .NET iOS block-based observer (`NSObject.Observer`, private) unregisters itself only in `Dispose(true)`. Its finalizer just logs `Warning: observer object was not disposed manually with Dispose()` and releases the native object. KVO does not retain observers, so an observer that is collected instead of disposed is freed while still registered. What happens next depends on the OS — measured with a probe that tracked the native observer through a zeroing weak reference and dumped the observed layer's `observationInfo`: | OS | State of the registration after the observer is freed | Next KVO notification on the object | |---|---|---| | iOS 17.5 | `NSKeyValueObservance` keeps an **unretained** pointer to the freed observer | Crash in `_NSKeyValueObservationInfoGetObservances` (even `-[NSKeyValueObservationInfo description]` crashes) | | iOS 18.6, 26.x | `NSKeyValueObservance` reads `Observer: 0x0` — a **zeroing weak** reference | Dead observer is skipped; the stale registration lingers | This is why the crash reproduces only on iOS 17-class devices and why nothing shows on current simulators. `-[UIView dealloc]` is where it usually surfaces because UIKit clears the layer's delegate there, and a CALayer raises KVO for `delegate` from `CA::Layer::set_delegate`. #### How MAUI reached it `ViewExtensions.OnLoaded` (iOS) has two paths. Platform views implementing `IUIViewLifeCycleEvents` raise `MovedToWindow`. Every other platform view — `PlatformGraphicsView`, `UIButton` (Button, ImageButton), `UISlider`, `UISwitch`, `UIStepper`, `UIProgressView`, the raw `UIImageView`/`UIScrollView` handlers and the web views — fell back to two managed KVO observers on the view's layer (`bounds` and `frame`), removed only once the view was loaded or the token disposed. A view that never reaches a window (a measured-but-never-shown template, a page discarded before it appears) keeps them until collection, and the collector frees the view and its observers in no particular order. Whenever an observer went first, the view's own `dealloc` hit the dangling pointer. Four more sites used the same overload: `MauiCollectionView` (`contentOffset`), `WindowHandler` (window `frame` and scene `effectiveGeometry`), `WindowOverlay` (window `frame`) and `VisualDiagnosticsOverlay` (`contentOffset`). The legacy compatibility `SetBinding` observer (`NativeViewPropertyListener`) is a different mechanism and is left alone. #### The fix **`MauiKeyValueObserver` (Swift, `src/Core/AppleNative`).** Typed `observe(\.keyPath)` for a closed set of keys — layer `bounds`, view `frame`, scroll view `contentOffset`, window scene `effectiveGeometry` (`@available` 16) — each owned by an `NSKeyValueObservation` token that unregisters on `invalidate()` and on `deinit`. A registration therefore cannot outlive its observer, whatever order the collector frees things in; the native release runs on the main thread through the same disposer drain visible in the crash. Same pattern as the existing `MauiCALayerAutosizeToSuperLayerBehavior`. The closed set is deliberate: a new observed key needs a native change, which keeps KVO from spreading casually. The UIKit methods are `@MainActor` because Swift 6 only lets those key paths be formed on the main actor; the compiled framework imports no runtime isolation-check function, so this is a compile-time constraint only. **`KeyValueObservation` (C#, internal).** Static factories per key (`ObserveBounds(CALayer, Action)`, `ObserveFrame(UIView, Action)`, `ObserveContentOffset(UIScrollView, Action)`, `ObserveEffectiveGeometry(UIWindowScene, Action)`) returning an `IDisposable`. The native side retains the block it is given, and a block pins its managed delegate: handing Swift the caller's handler directly would let the handler reach the observation (in `OnLoaded` it does, through the closure) and root the whole graph forever — the crash would become a leak. The facade therefore hands Swift a callback that holds only a `WeakReference` to itself; the real handler lives in a managed field and may capture anything. Two device tests fail without this trampoline. **Call sites.** `OnLoaded` observes only the layer's `bounds` through the facade; `MauiCollectionView`, both `WindowHandler` proxies, `WindowOverlay` and `VisualDiagnosticsOverlay` use the matching factory. Handlers no longer take an `NSObservedChange`; the effective-geometry handler reads `scene.EffectiveGeometry` directly, the same value the change payload carried. **Layer `frame` is not observable.** A probe observing `frame` and `bounds` separately on a layer showed zero `frame` notifications for `layer.Frame =`, `view.Frame =`, `view.Bounds =` and an autoresize layout pass, while `bounds` fired for each: `CALayer` raises KVO from its stored attributes only and `frame` is derived. The old `OnLoaded` frame observer was a no-op, so it is simply dropped. (`UIView.frame` does notify on `setFrame:` and on layout-driven resizes, which is what the window observers rely on.) **`PlatformTouchGraphicsView` implements `IUIViewLifeCycleEvents`** exactly like `MauiLabel` and the other MAUI views, so `GraphicsView` — the view in the report — takes the `MovedToWindow` path and registers no observation at all. This also makes `Unloaded` fire properly for it. It requires a public `MovedToWindow` override: one line in each Apple `PublicAPI.Unshipped.txt`, the only public API change in the PR. **TestUtils `AssertionExtensions.Collect()`.** While verifying on iOS 17.5, the four existing `MauiCALayerAutosizeToSuperLayerBehavior_DoesNotLeak` cases failed there on pristine `main` too. They were not leaking: `Collect()` only ever yielded to the thread pool, but a finalized wrapper releases its native peer on the main thread (disposer drain), and a released `UIView` hands its layer to the pending Core Animation transaction, which frees it only on commit. Each link of that chain (view → layer → toggle-ref'd sublayer) needs a main-thread turn, and the 40-iteration loop outran it on 17.5. `Collect()` now hops to the main thread through the same queue the disposer uses (so it lands after the drain) and calls `CATransaction.Flush()` there. A hop alone was not enough; the flush is the decisive part. Apple platforms only, `#if IOS || MACCATALYST`. #### Not changed, on purpose (follow-ups) - The stock UIKit-backed handlers (Button, ImageButton, Slider, Switch, Stepper, ProgressBar, raw image/scroll/web views) still infer `Loaded` from a layer `bounds` change. It is now safe, but small subclasses raising `MovedToWindow` (created in each handler's `CreatePlatformView`, without changing the generic platform-view type) would remove the heuristic altogether. - `VisualDiagnosticsOverlay.AddScrollableElementHandler` resolves the target with `ToPlatform()`, which returns the container view for a wrapped ScrollView (Shadow, Clip); such ScrollViews get no observation, as before. The right target is `Handler.PlatformView`. - `VisualDiagnosticsOverlay` throws on a duplicate `IScrollView` registration (pre-existing). ### Issues Fixed No issue was filed; this comes from a production crash report (iPhone 15, iOS 17.5, arm64) with the stack above, hitting `PlatformGraphicsView` release. Happy to open one if a tracking issue is preferred. ### Tests **`Core.DeviceTests` → `Memory/KeyValueObservationTests`** (iOS + Mac Catalyst): - `ObservesUntilDisposed` — layer bounds, view frame and scroll content offset all notify; nothing notifies after `Dispose`. - `CanBeDisposedFromItsOwnHandler` — disposing from inside the callback (what `OnLoaded` does when the view turns out to be loaded) is safe. - `HandlerReferencingItsObservationDoesNotLeak` — a handler that reaches its own observation is still collectable (the weak trampoline). - `OnLoadedOnViewsThatNeverLoadSurvivesCollection` — 200 never-loaded views with `OnLoaded` tokens, collected together. **Crashes the original code on iOS 17.5** with the stack above. - `OnLoadedTokenCollectedBeforeItsViewLeavesTheViewUsable` — the harmful order: tokens collected while the views live on, then the views change frame. - `OnLoadedFiresThroughTheObservation` — a plain `UIView` (no lifecycle events) still gets `Loaded` through the new path. - `GraphicsViewLoadsThroughLifecycleEventsNotKvo` — `PlatformTouchGraphicsView` exposes `IUIViewLifeCycleEvents` and gets `Loaded` on attach. Results (`Category=Memory`, xharness, simulators): | Build | iPhone 15 / iOS 17.5 | iPhone 11 Pro / iOS 26 | |---|---|---| | Original `OnLoaded` + new fixture | **app crash**, `EXC_BAD_ACCESS` in `-[UIView dealloc]` (stack above) | 11/11 pass (no crash — iOS 18+ skips dead observers) | | Fix with the handler passed to Swift **directly** (no weak trampoline) | — | `HandlerReferencingItsObservationDoesNotLeak` and `OnLoadedOnViewsThatNeverLoadSurvivesCollection` **fail** (leak) | | This PR | **13/13** (incl. the 4 autosize leak tests, which fail on pristine `main` there) | **13/13** | Also verified: `Controls.Core` builds clean for `net10.0-ios` and `net10.0-maccatalyst` with the PublicAPI analyzer; the probe results above (observance state per OS, layer `frame` never notifying, the autosize "leak" resolving by itself after one more second) are from throwaway tests that are not part of the change. **A note on CI coverage.** The two crash-reproducing tests only discriminate on iOS 17 and older: on iOS 18+ Foundation skips a dead observer, so they pass with the original code too (the two leak tests discriminate everywhere). If CI runs device tests on current simulators only, this class of bug — a use-after-free that newer Foundation happens to tolerate — stays invisible until it ships to older devices. It would be worth running the device-test suites (at least `Memory`) on an iOS 17.x simulator on some cadence, e.g. a scheduled weekly job or a runtime matrix entry for the Apple lanes, since iOS 17 devices are still very much in the field. The `Collect()` fix in this PR makes the `Memory` category green on 17.5 so such a lane would start clean.
### Description of Change Sort generated global XML namespace definitions by XML namespace, target CLR namespace, and assembly name before emitting `Global.Xmlns.cs`. Previously, equivalent compilations with the same metadata references in a different order produced different generated source. The attribute set was identical, but its order followed metadata reference enumeration order. This made the generator output non-deterministic and could surface as unnecessary generated-code changes during Edit and Continue / Hot Reload. Adds a regression test that: - creates two equivalent compilations with reversed metadata reference order; - runs the XAML generator for both; - verifies that all generated hint names and contents are identical. Validation: - `SourceGen.UnitTests`: 208/208 passed ### Issues Fixed Fixes #38841
<!-- 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 MenuItem is implicitly wrapped in an internal MenuShellItem when added to Shell. The wrapper assigns itself as the MenuItem.Parent and subscribes to MenuItem.PropertyChanged. When the wrapper is removed from Shell, these references were not released. A long-lived MenuItem could therefore retain the wrapper, its BindingContext, and the associated object graph, causing a managed memory leak on all platforms. ### Description of Change <!-- Enter description of the fix in this section --> Added connection lifecycle management to MenuShellItem: * Connects when the wrapper receives a parent. * Subscribes to MenuItem.PropertyChanged. * Assigns the wrapper as the MenuItem.Parent. * Disconnects when the wrapper is removed from its parent. * Unsubscribes from PropertyChanged. * Clears MenuItem.Parent when it still references the wrapper. * Uses _isConnected to prevent duplicate subscriptions and cleanup. ### 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 #38579 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <img src="https://github.com/user-attachments/assets/6694ded9-fab6-4b95-a7ee-8b89fed9a048" width="300" height="600"> | **Android**<br> <img src="https://github.com/user-attachments/assets/9081afe5-7c29-4b9a-9a9c-ad44086cac2b" width="300" height="600"> |
…llectionView items (#39012) <!-- 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 Recreates #37674 for `inflight/current`, porting the merged commit 904c032 without unrelated `main` changes. The implementation and four device regression tests are preserved; the accessibility extension's whitespace is normalized to repository formatting. Selectable CollectionView items on iOS/Mac Catalyst apply the Button accessibility trait to the first exposed accessibility element within the item template instead of an inaccessible container. Native UIControl subtrees keep their existing roles. Per-cell state tracks traits added by CollectionView so disabling selection clears only framework-added traits, preserving developer-assigned Button traits. Includes the original semantic-property mapper hook and device tests for nested accessibility elements, native-control roles, disabling selection, and changing accessibility targets. ### Issues Fixed Fixes #37140. Original PR: #37674 by @Dhivya-SF4094. ### Validation - Original patch applied cleanly to `inflight/current` and matched the source commit's stable patch ID before whitespace formatting. - Formatting verification and `git diff --check` passed. - MAUI build tasks and the Mac Catalyst Controls device-test app built successfully. - Local execution of the four original regression tests was attempted but blocked: the pinned XHarness tool requires `Microsoft.NETCore.App 11.0.0-rc.1.26420.103`, which is not installed. No passing device-test result is claimed; CI validation is pending. Co-authored-by: Dhivya-SF4094 <127717131+Dhivya-SF4094@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…from the items source instead of walking every position (#39063) > [!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 After #38969, `GridLayoutManager` still resolves the span index / row of a position it has not cached yet by calling `getSpanSize()` for every position from the nearest cached key to the target — a JNI round-trip each. `ScrollTo` into a cold region of a large grid, or laying out rows while scrolling back up past the cached keys, is O(n) per lookup: 200 000 grouped items, `ScrollTo` last group blocks the UI thread for 12.8 s (6.9 s flat). ### Root Cause `GridLayoutSpanSizeLookup` only overrides `GetSpanSize`; `GetSpanIndex`/`GetSpanGroupIndex` fall back to AndroidX's walk. ### Description of Change Override `GetSpanIndex`/`GetSpanGroupIndex`. The items source already knows where full-span items sit, so the layout is a short list of blocks (a full-span item, or a run of regular items that starts on a fresh row) and the answer is arithmetic plus a binary search. The table is rebuilt lazily after `AdapterDataObserver` notifications (the same ones `GridLayoutManager` uses to drop its own span caches) or a span-count change; adjacent groups without a separating header/footer are merged into one run because they share rows. Unknown adapters fall back to the base implementation. `ItemsViewAdapter` gains an internal `IItemsViewAdapter` view of its source; no public API change.⚠️ Since this is a follow-up PR of #38969, which is only merged to inflight/current, the source branch of this PR is based on inflight/current also. Tests and measurements for baseline are based on inflight/current with the first PR in place to demonstrate the diff on top of that improvement. If needed I can rebase onto main. ### Measurements (HONOR PGT‑N19, Release, 200 000 items, Span=4, UI thread blocked) Step | Grouped before | Grouped after | Flat before | Flat after -- | -- | -- | -- | -- Load | 127 ms | 110 ms | 83 ms | 110 ms ScrollTo end | 13 412 ms | 92 ms | 7 081 ms | 146 ms ScrollTo middle | 2 523 ms | 123 ms | 1 787 ms | 120 ms ScrollTo start | 112 ms | 127 ms | 203 ms | 141 ms | Before | After | |---|---| | <video src="https://github.com/user-attachments/assets/d8206648-bf64-4207-8b4e-dd195d217f8a" width="300"> | <video src="https://github.com/user-attachments/assets/ed798125-b2cc-4092-b1d2-6ad17c86d25b" width="300"> | ### Tests - Device: `GridSpanLookupMatchesGreedySpanAssignment` — 128 combinations checked position-by-position against the greedy assignment `GridLayoutManager` derives from `GetSpanSize`; `GridSpanLookupTracksGroupedSourceChanges` — item and group insertions. - UI: `Issue38926` — 200 000 items grouped and flat; `ScrollTo` end / middle / start must each finish within 5 s (before: 1.8–12.8 s; after: ~100 ms). ### Issues Fixed Fixes #38926
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> Fixes the ARGB value for MediumPurple color <!-- 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 #39076 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Jakub Florkowski <42434498+kubaflo@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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Wait for the swipe command's result text before asserting its exact value in `Issue36154SwipeViewShouldRevealItems`. `ResultLabel` already exists before the drag, so `WaitForElement` alone does not wait for command execution. The Windows leg of [inflight/current UI build 1621019](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1621019) contains both a pass and a failure on the same SHA. Run `44910192`, result `100088`, fails with the initial text `Swipe result will appear here` rather than `RIGHT invoked!`. Its [failure screenshot](https://dev.azure.com/dnceng-public/public/_apis/test/Runs/44910192/Results/100088/Attachments/9) still shows the initial text, while the subsequently captured [native page source](https://dev.azure.com/dnceng-public/public/_apis/test/Runs/44910192/Results/100088/Attachments/7) has `ResultLabel` with `Name="RIGHT invoked!"`. [The diagnostic capture code](https://github.com/dotnet/maui/blob/9e1139831877611d5ef9e20bfd8705b94a89a877/src/TestUtils/src/UITest.NUnit/UITestBase.cs#L288-L323) takes the screenshot before retrieving the element tree. This identifies a premature assertion, not just intermittent outcomes. The preceding [build 1617939](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1617939) also contains both outcomes for this exact Windows test; all five sampled preceding builds contain a pass, with unchanged test and host source. This one-line change asserts success from the existing bounded `WaitForTextToBePresentInElement` helper, then retains the original exact equality. The gesture, platform coverage, product implementation and visual baselines are unchanged. No whole-test retries, sleeps or timeout overrides are added. **Validation** - `dotnet build Microsoft.Maui.BuildTasks.slnf --nologo --verbosity quiet` — passed. - `dotnet build src/Controls/tests/TestCases.Mac.Tests/Controls.TestCases.Mac.Tests.csproj --no-restore --nologo --verbosity quiet -m:2 -nr:false` — passed, zero warnings/errors; compilation only, no UI execution. - `dotnet format whitespace --folder --include src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36154.cs --verbosity quiet` — passed. - `git diff --check` — passed. - `pwsh -NoProfile .github/scripts/BuildAndRunHostApp.ps1 -Platform catalyst -TestFilter 'FullyQualifiedName~Issue36154SwipeViewShouldRevealItems'` — initial attempt required rebuilding MSBuild tasks; subsequent attempt stopped during test-project compilation at the user's request, before UI/Appium/XCTest execution. No local runtime result is claimed. After-fix Windows runtime validation is pending CI. The PR will be watched for actual test results and earlier runner attempts rather than treating a retried green job as proof that the flake is eliminated. ### 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 the timing-sensitive assertion in the SwipeView regression test for #36154. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
… fails (#39149) ### Description of Change On iOS, a `ListView` with `HasUnevenRows="True"` whose cells contain URI images logs: ``` Microsoft.Maui.Handlers.IImageHandler: Error: Unexpected exception in MapSource. System.InvalidOperationException: PlatformView cannot be null here at Microsoft.Maui.Handlers.ImageHandler.ImageImageSourcePartSetter.SetImageSource(UIImage platformImage) at Microsoft.Maui.Platform.ImageSourcePartExtensions.UpdateSourceAsync(...) ``` **Root cause** 1. `ListViewRenderer.CalculateHeightForCell` measures a cell and then disconnects its handlers. `ImageHandler.DisconnectHandler` calls `SourceLoader.Reset()`, which cancels the pending load. 2. `UriImageSource.DownloadStreamAsync` catches the `TaskCanceledException` and returns a `null` stream, so `UriImageSourceService` throws `InvalidOperationException("Unable to load image stream from URI ...")` instead of an `OperationCanceledException`. 3. In `ImageSourcePartExtensions.UpdateSourceAsync` (iOS), that exception goes to the generic `catch`, which calls `setImage(null)`. The success path already skips `setImage` when the token is cancelled; the error path doesn't. 4. `SetImageSource` reads `Handler.PlatformView` on the disconnected handler, and the typed getter throws. The exception escapes the `catch` block, so `LoadingFailed` isn't raised either, and `MapSource` logs it. **Fix** In `UpdateSourceAsync`, an exception thrown after the token was cancelled is handled like an `OperationCanceledException`: no `setImage(null)`, and `LoadingCompleted(false)` instead of `LoadingFailed`. This matches the `!cancellationToken.IsCancellationRequested` check on the success path. Failures of loads that weren't cancelled are handled as before. The change is limited to `src/Core/src/Platform/iOS/ImageSourcePartExtensions.cs` (iOS and Mac Catalyst). Android has a similar `catch`, but it loads into the `ImageView` through Glide and the issue isn't reported there, so I left it unchanged. **Tests** - New device test `CancelledLoadThatFailsDoesNotUpdateDisconnectedHandler` (iOS/Mac Catalyst). It starts a load with `CountedImageSourceServiceStub`, disconnects the handler while the load is pending, and lets the service throw a non-cancellation exception, as `UriImageSourceService` does. It then expects `UpdateImageSourceAsync` to complete and only `LoadingCompleted(False)` to be raised. - To support this, `CountedImageSourceStub` has a new `FailWhenCancelled` option, which the iOS stub service honors. Verified locally on Mac Catalyst (Release): | | Without fix | With fix | |---|---|---| | New test | Fails with `InvalidOperationException: PlatformView cannot be null here` (same stack as the issue) | Passes | | `Category=Image` | 91 passed, 1 failed, 8 skipped | 92 passed, 8 skipped | With the fix, I also ran `Image` on the iOS simulator, plus the categories that cover the other `ImageSourcePartLoader` users on iOS (`ImageButton`, `Button`, and `SwipeView` for `SwipeItemMenuItem`) and `ImageSource`: | Platform | Category | Result | |---|---|---| | iOS 26.5 simulator | `Image` | 97 passed, 3 skipped | | Mac Catalyst | `ImageButton` | 149 passed, 14 skipped (includes the new test via `ImageButtonImageHandlerTests`) | | Mac Catalyst | `ImageSource` | 66 passed, 2 skipped | | Mac Catalyst | `Button` | 107 passed, 6 skipped | | Mac Catalyst | `SwipeView` | 64 passed, 6 skipped | A local run of the whole Core device test suite on Mac Catalyst timed out without producing results, so I ran these categories one at a time instead and relied on CI for the full suite. ### Issues Fixed Fixes #38845 --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@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! <!-- !!!!!!! 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 [#38915](#38915), "Add iPhone Duo support to Controls.Foldable", from squash commit `a561eaec4aacbe962416c64491aa5ffbc6bde9ae` to **`inflight/current`**, as explicitly requested. Preserves the source implementation: view/window-scoped reserved-region geometry, hinge monitoring and lifecycle cleanup, scene activation support, shared layout refresh, state triggers, sample updates, and Foldable unit tests. Original author and source coauthors are preserved. The only cherry-pick conflicts were in `.github/scripts/RunTests.ps1` and `.github/scripts/shared/Detect-TestsInDiff.ps1`. Resolution retains this branch's Compatibility test entries and adds the source Foldable mappings. Formatting is scoped to changed C# files; the formatter's unrelated Android null-conditional event rewrite was not retained. **SDK limitation:** the source's native Duo path is enabled only for iOS target platform version 27.1+ (or an explicit `IosDuoBindingsAvailable` override with compatible bindings). This target branch currently defaults to iOS 26.0, so its default build retains fallback behavior rather than enabling Duo APIs. This PR does not upgrade the branch-wide SDK/workload or remove capability/runtime guards. Publishing actual Duo-enabled artifacts requires a compatible iOS 27.1 SDK build configuration. **Validation run in this backport worktree** using .NET SDK `11.0.100-preview.6.26359.118`, targeting this branch's `net10.0` TFMs, and Xcode 26.6: | Command | Result | | --- | --- | | `dotnet test src/Controls/Foldable/test/Controls.Foldable.UnitTests.csproj --nologo --verbosity minimal` | Passed: 39, failed: 0, skipped: 0; rerun after formatting and normal restore. | | `dotnet build src/Controls/Foldable/src/Controls.Foldable.csproj -f net10.0-ios26.0 --nologo --verbosity minimal` | Passed: 0 warnings, 0 errors. | | `dotnet build src/Controls/Foldable/src/Controls.Foldable.csproj -f net10.0-maccatalyst26.0 --no-restore --nologo --verbosity minimal` | Passed: 0 warnings, 0 errors. | | `dotnet build src/Controls/Foldable/src/Controls.Foldable.csproj -f net10.0-android36.0 --no-restore --nologo --verbosity minimal` | Passed: 3 Gradle Java 8 obsolescence warnings, 0 errors. | | `dotnet build src/Controls/Foldable/src/Controls.Foldable.csproj -f net10.0-ios27.1 -p:TargetFrameworks=net10.0-ios27.1 --nologo --verbosity minimal` | Blocked: NETSDK1140, local SDK supports iOS 26.0/26.5, not 27.1. | | `git diff --cached --check` | Passed. | | `git diff --check` | Passed. | Formatting command (passed; `changed_files` contains staged changed `.cs` paths): ```bash changed_files=() while IFS= read -r file; do changed_files+=("$file"); done < <(git diff --cached --name-only -- '*.cs') dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include "${changed_files[@]}" --verbosity quiet ``` PowerShell syntax check (passed for all three source script files): ```powershell $files=@(".github/scripts/RunTests.ps1", ".github/scripts/shared/Detect-TestsInDiff.ps1", ".github/scripts/shared/Detect-TestsInDiff.Tests.ps1") foreach ($file in $files) { $tokens=$null; $errors=$null [System.Management.Automation.Language.Parser]::ParseFile((Join-Path $PWD $file), [ref]$tokens, [ref]$errors) > $null if ($errors.Count) { $errors | Write-Error; exit 1 } Write-Output "Parsed $file" } ``` Build/test/format subprocesses ran with `GH_TOKEN`, `GITHUB_TOKEN`, and `COPILOT_GITHUB_TOKEN` removed from their environments. A `--no-restore` test attempt after the explicit 27.1 restore probe encountered changed assets; normal restore and the full 39-test rerun above succeeded. **Not run:** native iOS 27.1/Duo compilation or simulator/device runtime validation, sample app build/runtime validation, Windows validation, or pipeline Pester tests. No XCTest or host UI automation was used. Source PR validation is not claimed as a result of this backport. ### 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. --> Backport of [#38915](#38915); no separate issue. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 741e14bf-fe5c-4150-857c-40b354de3403
Preserve both branch histories and use promoted main's source tree after auditing all 84 inflight-only commits for patch equivalence. Retain the intentional Tizen removal and iOS rotation revert; set nightly branding to 11.0.10-ci.inflight. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7a826651-369d-4a03-bab9-d21ed53be922
This comment has been minimized.
This comment has been minimized.
Skill Validation Results
|
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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Independently mark the .NET 11 GA public APIs as shipped on **main**, preserving later API changes as unshipped. This is a standalone main baseline change, not a port or cherry-pick of another PR. It does not depend on #39474 being finalized or merged; that release-targeted PR remains separate and unchanged. The GA boundary is the stable-packaging snapshot `e818662f833cb7a9ecd7c3f7fc95f2a72cfb0359` (#39473). Independently run the repository's `eng/scripts/mark-shipped.ps1` on isolated copies of that snapshot's baseline pairs that still exist and have pending GA APIs. Compare the resulting API sets against main, retaining the relative order of existing shipped records and subsequent unshipped entries. No baseline file from another PR is needed to derive or validate this change. - Update **50 baseline pairs (100 files)** to record the GA shipped API set. - Keep all **45 post-GA additions** unshipped. A blanket rollover of current main would incorrectly mark those later APIs as GA. - Record three post-GA Android `PickerHandler2` removals explicitly in unshipped. The GA signatures using `MauiMaterialPicker` become shipped; their `MauiMaterialPickerTextInputLayout` replacements remain unshipped. - Preserve the effective main API set, existing surviving shipped order, later-unshipped order, and analyzer-generated nullable-oblivious markers. Do not retain removal directives in shipped files. - Leave the other **11 surviving baseline pairs** byte-identical and do not recreate any deleted inventories, including Tizen. The branch starts at main `9f07f6e79380c4d876a6537b26c791e2f2da7ee6`. Refreshed main `8ba0783db96fe19042891d27cc162b6416de0b90` has identical baseline files, and the independent validation was repeated against it. Independently regenerated GA API sets match the existing patch, so no additional baseline edits or history rewriting were needed. No product code, versioning, pipeline, dependency/feed, internal mirror, inflight, .NET 10 servicing, or release-ref changes. This is separate from main housekeeping #39805 and inflight #39806. See `docs/design/APIChangeTracking.md` for baseline tracking and rollover conventions. Validation: ```bash api_args=(-f net11.0 -c Release -p:PublicApiType=Validate -p:TargetFrameworks=net11.0 -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -nologo -v:quiet) dotnet build src/Essentials/src/Essentials.csproj -t:Rebuild "${api_args[@]}" dotnet build src/Graphics/src/Graphics/Graphics.csproj --no-restore -t:Rebuild "${api_args[@]}" git diff --check HEAD~1 HEAD ``` Both neutral Release rebuilds **passed, 0 warnings and 0 errors**, with `PublicApiType=Validate`. The initial Graphics `--no-restore` attempt reported NETSDK1004 (missing assets); the Essentials build restored the required assets before both final rebuilds passed. A further Essentials `--no-restore -t:Rebuild` with normal verbosity confirmed actual compiler execution, public-API analyzer references, and baseline additional files for both projects. The commit and compiler-validated baseline content are unchanged by this PR clarification. `git diff --check HEAD~1 HEAD` passed again. Independent session-artifact check: ```bash python3 /Users/kubaflo/.copilot/session-state/28e76aab-35f9-40d4-b195-d7948511195a/files/validate-independent-main-baseline.py ``` **Passed:** independently executed `mark-shipped.ps1` against the stable GA snapshot; exact resulting shipped API sets; effective API conservation; no duplicates or unmatched removals; surviving shipped and later-unshipped order; 45 later additions and 3 later removals; 11 untouched surviving pairs; all 10 baseline pairs deleted since the GA snapshot still absent; exactly 100 baseline files changed; refreshed main baseline inputs unchanged. The validation script and isolated generated files are session artifacts, not repository changes. Open/recently merged shipped-baseline changes were checked before publication; no competing main rollover was found. **Limitations / merge requirements:** Local builds used installed SDK `11.0.100-preview.6.26359.118`; pinned `11.0.100-rtm.26514.118` is unavailable locally. These are representative neutral analyzer checks, not RTM or full-platform certification. Native Android/Apple/Windows builds, device/UI tests, signing/packaging, and the full CI suite were not run locally. Required CI and human review still apply. The PR remains a draft; no merge is requested here. There is no cross-PR merge dependency. ### 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. --> N/A - standalone .NET 11 GA API baseline bookkeeping on main; no bug issue is closed. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
4606786 to
f6b9897
Compare
|
Superseded by the user-requested direct rebase of inflight/current onto main. New inflight head: f6b9897 (main 3bfd980 plus SR1 nightly branding). All prior nonempty inflight patches were already upstream. Published with an explicit lease against 4606786; .NET 10 SR13 release refs/assets, internal refs and channel mappings were not changed. Managed build and Core/Controls tests passed locally; RTM/native/signed-pack coverage and correct .NET 11 channel routing remain outstanding. This PR was not merged. |
<!-- 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 --> Finish repository housekeeping after #39688 promoted .NET 11 to `main`, following the separate main-versioning cleanup used after the .NET 10 promotion (#32370). - Set the SR1 development version to `11.0.10-ci.main`, clear the RC2 iteration, and retain `StabilizePackageVersion=false` and the `ci.inflight` override. - Remove the obsolete main → net11.0 and net11.0 → RC2 workflows/configuration. Both live workflows have been disabled; their empty generated PR #39803 was closed. - Make the historical net11 CI scanner manual-only and regenerate its lock with the existing gh-aw v0.86.2 compiler. Main's scanner remains unchanged. - Exclude net11.0 from official scheduled nightlies alongside net10.0, and document the branch lifecycle. **Release isolation:** .NET 10 SR13 remains on `release/10.0.1xx-sr13` at `4bd53f09e828cfc6a6a565bcfe3a9f80df9b3d5f` in both public and internal repositories. Signed build [3122048](https://dev.azure.com/dnceng/internal/_build/results?buildId=3122048) succeeded at that release commit. This PR changes no release branch, package, dependency pin, feed mapping, release pipeline, internal mirror ref, or live inflight ref. The separate inflight migration is prepared in #39806; its live cutover and the internal main mirror sync are held until today's SR13 publication finishes. **Draft gates:** - Coordinate the separate Maestro `main` output-channel/subscription migration before allowing .NET 11 official main publishing. The current live mapping still points main at the .NET 10 channel. No Maestro mutation has been executed without approval of its exact commands. Separate SR13 and .NET 11 config patches are prepared locally, not applied to production. - The existing .NET 11 GA API baseline work remains in #39474, with a selective main port handled separately; no blanket main API rollover or unreleased version-dropdown entries are included here. - CI is not green. Product validation [1659645](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1659645) was queued against this exact PR head. Existing [Pester validation](https://github.com/dotnet/maui/actions/runs/41429971591) reports 2,252 passed and five failed: two stale GPT-6 Astra assertions and three Windows XAML assertions, including references to removed Compatibility files. All failing test definitions, reviewer source and XAML inputs are byte-identical to promoted main `9f07f6e79380c4d876a6537b26c791e2f2da7ee6`; this PR changes none of them. The same five failures reproduced locally using the existing tests. No unrelated test/source correction is included. Validation: - `gh aw compile ci-status-net11` — passed, one workflow compiled with zero warnings. - `gh aw list ci-status-net11 --json` — passed; reports `compiled: Yes` and only `workflow_dispatch`. - `ruby -e 'require "yaml"; ARGV.each { |p| YAML.parse_file(p); puts "YAML syntax OK: #{p}" }' eng/pipelines/ci-official.yml .github/workflows/ci-status-net11.lock.yml` — passed. - `dotnet msbuild eng/Versions.props -nologo -getProperty:MajorVersion,MinorVersion,PatchVersion,PreReleaseVersionLabel,PreReleaseVersionIteration,StabilizePackageVersion,WorkloadVersionSuffix -p:BUILD_SOURCEBRANCH=refs/heads/main` — passed before and after push; `11/0/10`, `ci.main`, empty iteration, stabilization `false`, suffix `-ci.main`. - `dotnet msbuild eng/Versions.props -nologo -getProperty:PreReleaseVersionLabel,PreReleaseVersionIteration,WorkloadVersionSuffix -p:BUILD_SOURCEBRANCH=refs/heads/inflight/current` — passed; `ci.inflight`, empty iteration, suffix `-ci.inflight`. - `git diff --check` — passed. - `actionlint -shellcheck='' .github/workflows/ci-status-net11.lock.yml` — local linter reports unsupported existing `concurrency.queue` and `github.aw.import-inputs` syntax. Running that linter against the unmodified promoted-main lock reproduced the same diagnostic types. Compiler validation above passed. - Existing Pester reproduction: `Invoke-Pester` with Pester 5.9.0, paths `.github/scripts/CopilotPipeline.Tests.ps1`, `.github/scripts/Review-PR.Tests.ps1`, `eng/pipelines/arcade/windows-xaml-trimming.Tests.ps1`, and `Filter.FullName=@('*pins the local test reviewer*','Windows XAML binding behavior.*')` — the same five selected tests failed. No tests were added or edited. - `git diff --exit-code origin/main HEAD -- src .github/scripts/CopilotPipeline.Tests.ps1 .github/scripts/Review-PR.Tests.ps1 .github/scripts/Review-Tests.ps1 eng/pipelines/arcade/windows-xaml-trimming.Tests.ps1` — passed, confirming unchanged failing inputs. - No new pipeline tests were written. Native/runtime and official signed-pack validation are not established by these configuration checks. ### 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. --> Follow-up to #39688; no separate bug issue. Retires the empty automated merge PR #39803 without touching .NET 10 SR13. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
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
Hold: do not merge until today's .NET 10 SR13 publication is complete. Native/RTM validation remains outstanding. This isolated draft does not move live
inflight/current, internal refs, release refs, assets, or Maestro channel mappings.Merge promoted .NET 11
main(9f07f6e79380c4d876a6537b26c791e2f2da7ee6, promotion #39688) intoinflight/current(4606786af1dbfe8d3494e680f284ccaf9b266e93) with a normal two-parent merge, preserving both histories. Advance nightly branding from .NET 10.0.130 to 11.0.10-ci.inflight, with no RC iteration.The resulting tree equals the promoted main tree except for
eng/Versions.propsbranding. Of the 84 commits unique to inflight history, 82 have patch-equivalent commits in main and two are empty Dependabot merge commits. No inflight-only functional change needs to be reimplemented. Conflict resolutions retain main's intentional Tizen removal (#39531), iOS rotation revert (#39707), newer Material3 theme handling, .NET 11 API shapes, snapshots, and AOT profiles. This avoids resurrecting superseded backports.Replaces the approach of closed, unmerged #39690 without reusing its accumulated corrective patches. No other open migration PR was found.
Validation (local SDK/runtime:
11.0.100-preview.6.26359.118, not the pinned RTM SDK):dotnet msbuild src/Workload/workloads.csproj -nologo -getProperty:PackageVersion,Version,WorkloadVersionSuffix,SdkBandVersionForWorkload_FromRuntimeVersions,PreReleaseVersionIteration,StabilizePackageVersion -p:BUILD_SOURCEBRANCH=refs/heads/inflight/current -p:OfficialBuildId=20261102.1— passed; package11.0.10-ci.inflight.26552.1, workload band11.0.100-ci.inflight, empty iteration, stabilization false.dotnet restore Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:quiet— passed.dotnet build Microsoft.Maui.BuildTasks.slnf --no-restore -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:quiet— passed, zero warnings/errors.dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:quiet— passed: 1,093 passed, 3 skipped.dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:quiet— 6,733 passed, 30 skipped, one culture-sensitive failure (TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull:3.14versus3,14).LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --no-build --no-restore -v:quiet— passed: 6,734 passed, 30 skipped.dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include eng/Versions.props— exit 0 with workspace-loading warnings; no source changes.git diff --quiet 9f07f6e79380c4d876a6537b26c791e2f2da7ee6 HEAD -- . ':!eng/Versions.props'— passed; exact source/configuration parity outside branding. Branding delta whitespace check passed. The full imported diff includes pre-existing whitespace from main, intentionally unchanged.bash eng/common/dotnet.sh --info— pinned RTM bootstrap did not complete: primary/legacy SDK URLs unavailable,ci.dot.netfallback stalled and was stopped. No RTM/native pass claimed.dotnet build Microsoft.Maui.BuildTasks.slnf --no-restore -v:quiet— initial unrestricted attempt failed on missing restore assets and Apple 27.0 target-platform support (installed workloads support 26.5). Managed restore/build above passed; native builds, runtime UI/device tests and signed workload packaging are still unverified.Issues Fixed
N/A — release engineering follow-up to #39688; intentionally targets
inflight/current, notmain. No issue is closed.