Repository navigation
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 40072Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 40072" |
This comment has been minimized.
This comment has been minimized.
|
Hey there @@KitKeen! 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 @KitKeen! 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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| viewModel.Icon = CreateIcon("B", Colors.Blue); | ||
|
|
||
| var updatedImage = handler.PlatformView.Image; |
There was a problem hiding this comment.
[moderate] Regression Prevention and Test Coverage - This test checks only the handler-owned command, so it would still pass if the new image synchronization in MauiUIApplicationDelegate.ValidateCommand were removed. The menu-bar scenario in #17210 also needs the separately validated command to receive the updated icon. Add a regression assertion using a separate UICommand with the handler command's PropertyList: change the bound icon, call ValidateCommand, and verify that command's image updates. The current fixture never exercises that part of the fix.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…d and restore file encodings
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0698313
into
dotnet:candidate/11.0.1xx-sr2
There was a problem hiding this comment.
🟡 Changes recommended
The headless-test fallback fails to restore global application references, leaving subsequent tests with an uninitialized fake application.
3 open issues
What changed in this PR
Addresses #17210 by connecting runtime MenuFlyoutItem.IconImageSource changes to native icon updates on Windows, iOS, and MacCatalyst.
Changes:
- Notifies the handler when an icon source is replaced or mutated.
- Adds Apple source mapping and synchronizes icons during menu-command validation.
- Adds unit and device tests for source notifications, bound icons, and command validation.
| File | Description |
|---|---|
src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt |
Records the MacCatalyst MapSource API. |
src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt |
Records the iOS MapSource API. |
src/Core/src/Platform/iOS/MenuExtensions.cs |
Updates images on native actions and commands. |
src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs |
Copies updated icons to validated commands. |
src/Core/src/Handlers/MenuFlyoutItem/MenuFlyoutItemHandler.iOS.cs |
Implements the Apple source mapper. |
src/Core/src/Handlers/MenuFlyoutItem/MenuFlyoutItemHandler.cs |
Registers source mapping across supported platforms. |
src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.Windows.cs |
Tests bound icon replacement on Windows. |
src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs |
Tests Apple icon replacement and command synchronization. |
src/Controls/tests/Core.UnitTests/MenuItemTests.cs |
Tests handler notifications for icon changes. |
src/Controls/src/Core/Menu/MenuItem.cs |
Dispatches source updates after replacement or mutation. |
Review effort: Balanced
| var appDelegate = (MauiUIApplicationDelegate.Current as MauiUIApplicationDelegate) ?? new TestApplicationDelegate(); | ||
| appDelegate.ValidateCommand(validatedCommand); |
| #if MACCATALYST || IOS || WINDOWS | ||
| [nameof(IMenuElement.IsEnabled)] = MapIsEnabled | ||
| [nameof(IMenuElement.IsEnabled)] = MapIsEnabled, | ||
| [nameof(IMenuElement.Source)] = MapSource, |
| if (uiMenuElement is UIAction action) | ||
| action.Image = image; |
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes #17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for #40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by #40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to #40116 and #40072. <!-- 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>
### 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 When `MenuItem.IconImageSource` is updated at runtime (either by assigning/binding a new `ImageSource` or by mutating a property on the bound `ImageSource`), `MenuFlyoutItem` did not update its native menu icon: 1. `MenuItem` defines `IconImageSourceProperty` (`IconImageSource`), whereas `IMenuElement` / `IImageSourcePart` maps `nameof(IMenuElement.Source)` (`Source`). `OnImageSourceChanged` and `OnImageSourceSourceChanged` now notify `Handler?.UpdateValue(nameof(IMenuElement.Source))`. 2. `MenuFlyoutItemHandler.Mapper` previously only mapped `nameof(IMenuElement.Source)` on Windows. Added `MapSource` for iOS and MacCatalyst (updating `UIAction.Image` / `UICommand.Image` via `MenuExtensions.UpdateImageSource`, and syncing `command.Image` in `MauiUIApplicationDelegate.ValidateCommand`). 3. Added unit tests in `MenuItemTests` and device tests for `Issue17210` on Windows, iOS, and MacCatalyst. ### Issues Fixed Fixes dotnet#17210 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated, candidate-only compilation repair for dotnet#40116, based on `candidate/11.0.1xx-sr2` at `7e47665ecb7f68d3fb31f8d02806e2bf177f505d`. ### Description of Change <!-- Enter description of the fix in this section --> Add the missing `Microsoft.Maui.Hosting` import to `Issue17210.iOS.cs`, introduced by dotnet#40072 (`0698313d8d9e5ccf1d1f4adabe1fba62699870c7`). Its nested `TestApplicationDelegate.CreateMauiApp()` returns `MauiApp`, which is declared in that namespace. The file compiles for both iOS and Mac Catalyst. This resolves the two CS0246 compiler failures in [maui-pr 1679721's Debug compiler log](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1679721/logs/207) (original diagnostics at physical lines 655 and 672; repeated summary at 1062 and 1063). No product code, assertions, test registration, override implementation, project settings, or pipeline changes. #### Compilation validation Native full-project `Compile` validation, **diagnostic toolchain only**: .NET SDK **11.0.100**, Apple SDK **27.2**, Xcode **27.2 (27B52)**. The candidate's pinned SDK `11.0.101-servicing.26559.106` / Apple **27.0** was unavailable locally. This is not pinned-toolchain certification or a runtime test. | Source state | iOS | Mac Catalyst | | --- | --- | --- | | Original candidate | CS0246: `MauiApp` | CS0246: `MauiApp` | | Import added | 0 errors | 0 errors | | Only import removed | Same CS0246 | Same CS0246 | | Import restored | 0 errors | 0 errors | Successful diagnostic runs retain the existing `CollectionViewTests.iOS.cs:180` CS0618 obsolete-handler diagnostic as a warning via **invocation-only** `-p:WarningsNotAsErrors=CS0618`; no warning settings are committed. Without that flag, the import eliminates CS0246 but this unrelated existing diagnostic remains an error. Successful runs each report two warnings: that CS0618 and the existing runner MAUI1001 warning. Compilation commands below passed for both targets with the import, failed with the same missing-type error when only the import was removed, and passed again when restored (binary-log paths omitted): ```bash for platform in ios maccatalyst; do rid=maccatalyst-arm64 if [ "$platform" = ios ]; then rid=iossimulator-arm64; fi dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \ -c Debug -f "net11.0-$platform" -t:Compile \ -p:MauiDeviceTestsPlatforms="net11.0-$platform" \ -p:MauiPlatforms="net11.0-${platform}27.2" \ -p:IosTargetFrameworkVersion=27.2 \ -p:IosTargetFrameworkVersionSdkDefault=27.2 \ -p:MacCatalystTargetFrameworkVersion=27.2 \ -p:MacCatalystTargetFrameworkVersionSdkDefault=27.2 \ -p:RuntimeIdentifier="$rid" \ -p:IncludeAndroidTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false \ -p:IncludeMacOSTargetFrameworks=false \ -p:WarningsNotAsErrors=CS0618 -v:q done ``` `dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/MenuFlyoutItem/Issue17210.iOS.cs --exclude Templates/src --exclude-diagnostics CA1822 --verbosity quiet` — passed. `git diff --check` — passed. Runtime tests and local Release compilation were not run; this repair changes name resolution only. No additional broad CI runs were manually queued. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to dotnet#40116 and dotnet#40072. <!-- 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>


Target Branch
mainnet11, for reviewDescription of Change
When
MenuItem.IconImageSourceis updated at runtime (either by assigning/binding a newImageSourceor by mutating a property on the boundImageSource),MenuFlyoutItemdid not update its native menu icon:MenuItemdefinesIconImageSourceProperty(IconImageSource), whereasIMenuElement/IImageSourcePartmapsnameof(IMenuElement.Source)(Source).OnImageSourceChangedandOnImageSourceSourceChangednow notifyHandler?.UpdateValue(nameof(IMenuElement.Source)).MenuFlyoutItemHandler.Mapperpreviously only mappednameof(IMenuElement.Source)on Windows. AddedMapSourcefor iOS and MacCatalyst (updatingUIAction.Image/UICommand.ImageviaMenuExtensions.UpdateImageSource, and syncingcommand.ImageinMauiUIApplicationDelegate.ValidateCommand).MenuItemTestsand device tests forIssue17210on Windows, iOS, and MacCatalyst.Issues Fixed
Fixes #17210