Repository navigation
[iOS, Mac Catalyst] Rebuild the menu bar when the Text of a menu item changes - #40190
Conversation
… changes WindowHandler.MapMenuBar builds the menu bar inside BuildMenu and then disconnects the menu handlers, so a later change to MenuBarItem.Text or MenuFlyoutItem.Text reached no handler and the menu bar kept the first text. A change of Text on a MenuBarItem, or on a MenuFlyoutItem inside one, now asks the window to update its MenuBar, which calls UIMenuSystem.MainSystem.SetNeedsRebuild, like adding or removing items already does. Items of a context flyout don't rebuild the menu bar. Fixes dotnet#21417
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 40190Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 40190" |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey there @@marcelomoresco! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey there @marcelomoresco! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This comment has been minimized.
This comment has been minimized.
|
/rebase |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
PR Test Gate
🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. No interpretable test-group summary was produced. No additional test execution is inferred. Setup did not capture a verified PR head; no commit is claimed as tested. No immutable without-fix baseline was prepared. |
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit 43d1b4a.
kubaflo
left a comment
There was a problem hiding this comment.
Could you check the failing tests?
|
@kubaflo I went through the failures in builds 1678187 (UI tests) and 1678188 (device tests):
Could you re-run the failed jobs? |
This comment has been minimized.
This comment has been minimized.
PR Test Gate
🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. No interpretable test-group summary was produced. No additional test execution is inferred. Setup did not capture a verified PR head; no commit is claimed as tested. No immutable without-fix baseline was prepared. |
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit 43d1b4a.
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
🧪 CI Analysis — click to expand📊 maui-prNo failures found. 🧪 maui-pr-devicetests
🧪 maui-pr-uitestsMatched failures predate these menu changes. All five target samples are partial; unmatched cases need equivalent base/head reproduction.
🧭 Follow-up — actions and refreshNext action: Compare unresolved tests on base/head with identical setup; inspect Helix termination and restore missing UI diagnostics.
|
8086a15
into
dotnet:candidate/11.0.1xx-sr2
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since #35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes #21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… changes (dotnet#40190) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). ### Description of Change On iOS and Mac Catalyst, `WindowHandler.MapMenuBar` builds the menu bar inside `BuildMenu` and then disconnects the menu handlers, because a `UIMenu` can only be built while `BuildMenu` runs. After that, a change to `MenuBarItem.Text` or `MenuFlyoutItem.Text` reaches no handler, and the built `UIMenu`/`UICommand` keep their titles, so the menu bar shows the first text. Adding or removing items already rebuilds the menu bar: `MenuBarTracker` calls `Window.Handler.UpdateValue(MenuBar)`, which calls `UIMenuSystem.MainSystem.SetNeedsRebuild()`, and `BuildMenu` creates new handlers from the current values. A change of `Text` on a `MenuBarItem`, or on a `MenuFlyoutItem`/`MenuFlyoutSubItem` inside one, now does the same (`MenuBar.UpdateWindowMenuBar`, called from the `propertyChanged` of `MenuBarItem.TextProperty` and `MenuItem.TextProperty`). Items of a context flyout don't rebuild the menu bar. `IsEnabled` (including `Command.CanExecute`) already updates since dotnet#35546, because `ValidateCommand` reads it when the menu opens, so this PR only changes `Text`. On Windows the menu handlers stay connected and already update the text; the extra `MenuBar` update sets the same `MenuBar` instance again. #### Tests Unit tests (`MenuBarItemTests`, Controls.Core.UnitTests): - changing the `Text` of a `MenuBarItem`, of a `MenuFlyoutItem` in it, and of an item inside a `MenuFlyoutSubItem` updates the window's `MenuBar` once - changing the `Text` of a context flyout item doesn't update it Results: - without the fix, the first three tests fail (Menu tests: 102 passed, 3 failed) - with the fix, all of Controls.Core.UnitTests passes: 6738 passed, 30 skipped, 0 failed (en-US locale; `TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull` fails under a pt-BR locale without this change too) Mac Catalyst app (Sandbox with a `BuildMenu` override that logs): renaming a `MenuBarItem` and a `MenuFlyoutItem` 6 seconds after launch makes UIKit call `BuildMenu` again 1-2 ms later. The rebuild then goes through the same path as adding an item, which `MenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocation` covers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar. ### Issues Fixed Fixes dotnet#21417 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…#40829) <!-- copilot-assessment:v1 --> ### Agent assessment Self-reported assessment, not an independent review. Assessed revision: `7ee14bce88236c49b0e3145e239c43937783dded` | Dimension | Assessment | Rationale | |---|---|---| | Change confidence | 8/10 | ↑ All five affected tests passed on initial attempts in Catalyst CI; no skips<br>↓ Shared drag-helper timing has wider test impact | | Diagnosis confidence | 7/10 | ↑ CI validates active-window fixture initialization and slower native drag delivery<br>↓ Exact OS scheduling cause is inferred, not independently reproduced locally | | Evidence fit | 8/10 | ↑ Raw initial-run TRX confirms the three target tests plus Clicked and removed-element drag passed<br>↓ One validating build, not two independent runs; no local Catalyst UI execution | <!-- /copilot-assessment --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change Fix repeating Catalyst UI-test failures without ignoring tests or changing product behavior. - **Issue20685:** initialize its menu through a real button click after the window is active, rather than requesting a menu rebuild during `Loaded`. UIKit's `BuildMenu` selects only active window scenes; an early rebuild can produce no custom menu. All three tests still open the real native menu and verify Clicked/Command/CommandParameter callbacks. Windows initialization is unchanged. - **Catalyst drag helper:** slow the drag from 2500 to 500 points/s and hold at the target for 1s rather than 0.1s, allowing Catalyst to recognize the drag and deliver target events before release. This also covers `DragAndDropWithAnElementThatIsRemoved`. - **Issue12060:** require an actual `DragOver` before reporting success, so a cancelled drag outside the target cannot falsely pass the accepted-operation regression test. #### Evidence [main build 1704474](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1704474), logs 5701 and 3989: - Both menu command tests fail on original/retry in `OpenMenuAndTapItem` line 25, waiting for **MenuItems**, before tapping the menu. Failure screenshots and accessibility page sources show the test page loaded and the stock menu bar, but **no MenuItems**. This is not an unexposed result label or a failed command callback. - `AcceptedOperationNoneDisablesDropOperation` fails on original/retry at line 24 waiting for **Success**. Screenshots and page sources show both boxes and Result=Running. The Mac2 log sends `macos: clickAndDragAndHold` with duration=1, velocity=2500 and holdDuration=0.1, returns success, then repeatedly finds no Success. Gesture delivery, not element discovery, is the suspected failure. - `DragAndDropWithAnElementThatIsRemoved` times out at line 24 waiting for **DropResult** on the initial run; it passes the in-job retry. This does not establish a recent product regression: the tests previously passed and the provided PR build sometimes recovered on retry. The changes address fixture initialization and gesture timing; The passing CI run below supports the hypotheses, but does not independently establish the exact OS scheduling cause. #### Duplicate search Searched open and closed/merged PRs across all bases for Issue20685, Issue12060, the target test names, MenuFlyoutItem, menu rebuild, Mac2 drag, and clickAndDragAndHold. No equivalent open fix found. #40190 (candidate/11.0.1xx-sr2, now merged) addresses runtime Text changes, not initial active-window menu construction; #39912 addresses screenshot geometry, not drag timing/menu initialization. Context-menu enhancements #40439/#40482 do not cover these menu-bar tests. #### Validation - `git diff --check` — passed. - `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/TestCases.HostApp/Issues/Issue20685.cs src/Controls/tests/TestCases.HostApp/Issues/Issue12060.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20685.cs src/TestUtils/src/UITest.Appium/Actions/AppiumCatalystTouchActions.cs --exclude Templates/src --exclude-diagnostics CA1822` — attempted; project references were not loaded (new checkout has no restored assets). Not claimed as a successful compiler/analyzer validation. - No local Catalyst Appium/XCTest UI automation was run. PR CI was requested with `/azp run maui-pr-uitests`. Initial build 1704524 canceled immediately without running tests; a second comment started validating build 1704526. #### Validating Catalyst CI — build 1704526 [Build 1704526](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1704526) compiled the CoreCLR sample successfully. All three relevant Catalyst jobs finished **succeeded**. Downloaded their published artifact TRX files, including the **initial-run raw TRX**, rather than inferring execution from a green job badge: | Test | Initial outcome | Duration | |---|---|---| | MenuFlyoutItem_CommandWorks | Passed | 4.54s | | MenuFlyoutItem_CommandWithParameterWorks | Passed | 4.04s | | MenuFlyoutItem_ClickedEventWorks (Shell1) | Passed | 4.29s | | AcceptedOperationNoneDisablesDropOperation | Passed | 4.12s | | DragAndDropWithAnElementThatIsRemoved | Passed | 5.16s | Evidence artifacts: `drop-maccatalyst_ui_tests_coreclr-Shell2-1`, `drop-maccatalyst_ui_tests_coreclr-Shell1-1`, and `drop-maccatalyst_ui_tests_coreclr-Job11-1` → `test-results/n-*/raw/*.trx`. No target test required an in-job retry. Assessed/tested head remains `7ee14bce88236c49b0e3145e239c43937783dded`. **Evidence limit:** this is one validating CI build, not two independent builds, and is not a claim that the entire cross-platform pipeline is green. No local Catalyst UI automation was run. ### 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. --> No new issue is closed. Stabilizes existing regression coverage for #20685, #12060 and #28416. ### Let AI finish this PR - [ ] **Let the MAUI agent address review feedback and fix remaining issues on this PR.** Maintainers still decide whether it is merged. For PRs from forks, keep "Allow edits by maintainers" on so the agent can push to your branch; otherwise it opens a follow-up PR that keeps your commits. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Target Branch
mainnet11, for reviewDescription of Change
On iOS and Mac Catalyst,
WindowHandler.MapMenuBarbuilds the menu bar insideBuildMenuand then disconnects the menu handlers, because aUIMenucan only be built whileBuildMenuruns. After that, a change toMenuBarItem.TextorMenuFlyoutItem.Textreaches no handler, and the builtUIMenu/UICommandkeep their titles, so the menu bar shows the first text.Adding or removing items already rebuilds the menu bar:
MenuBarTrackercallsWindow.Handler.UpdateValue(MenuBar), which callsUIMenuSystem.MainSystem.SetNeedsRebuild(), andBuildMenucreates new handlers from the current values. A change ofTexton aMenuBarItem, or on aMenuFlyoutItem/MenuFlyoutSubIteminside one, now does the same (MenuBar.UpdateWindowMenuBar, called from thepropertyChangedofMenuBarItem.TextPropertyandMenuItem.TextProperty). Items of a context flyout don't rebuild the menu bar.IsEnabled(includingCommand.CanExecute) already updates since #35546, becauseValidateCommandreads it when the menu opens, so this PR only changesText.On Windows the menu handlers stay connected and already update the text; the extra
MenuBarupdate sets the sameMenuBarinstance again.Tests
Unit tests (
MenuBarItemTests, Controls.Core.UnitTests):Textof aMenuBarItem, of aMenuFlyoutItemin it, and of an item inside aMenuFlyoutSubItemupdates the window'sMenuBaronceTextof a context flyout item doesn't update itResults:
TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNullfails under a pt-BR locale without this change too)Mac Catalyst app (Sandbox with a
BuildMenuoverride that logs): renaming aMenuBarItemand aMenuFlyoutItem6 seconds after launch makes UIKit callBuildMenuagain 1-2 ms later. The rebuild then goes through the same path as adding an item, whichMenuBarItemFeatureTests.MenuBarItem_LocationsMenuAddLocationcovers on Mac Catalyst. I launched the app from a script, so its window didn't have the active appearance and I couldn't take a screenshot of the menu bar.Issues Fixed
Fixes #21417