[Extensibility] Fix dual-path backend activation and Compile bucket filtering - #36956
Closed
PureWeen wants to merge 1 commit into
Closed
[Extensibility] Fix dual-path backend activation and Compile bucket filtering#36956PureWeen wants to merge 1 commit into
PureWeen wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ac6265fe-09a0-473c-b3f9-9ec6d6dd97cd
PureWeen
temporarily deployed
to
copilot-pat-pool
July 30, 2026 20:08 — with
GitHub Actions
Inactive
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36956Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36956" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
PureWeen
temporarily deployed
to
copilot-pat-pool
July 30, 2026 20:08 — with
GitHub Actions
Inactive
PureWeen
temporarily deployed
to
copilot-pat-pool
July 30, 2026 20:10 — with
GitHub Actions
Inactive
PureWeen
temporarily deployed
to
copilot-pat-pool
July 30, 2026 20:12 — with
GitHub Actions
Inactive
PureWeen
temporarily deployed
to
copilot-pat-pool
July 30, 2026 20:13 — with
GitHub Actions
Inactive
PureWeen
temporarily deployed
to
copilot-pat-pool
July 30, 2026 20:14 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens .NET MAUI SingleProject MSBuild extensibility for third-party backends by (1) allowing a single backend registration to activate through either recognized TPI matching or neutral-TFM backend selection, and (2) fixing _MauiRemovePlatformCompileItems so its removal batching can’t incorrectly remove Compile items from other metadata buckets.
Changes:
- Default
ActivationValuefromBackendIdentityeven whenTargetPlatformIdentifier(s)metadata is present, enabling dual-path activation. - Rework
_MauiRemovePlatformCompileItemsto root removal candidates in the batched@(Compile)identities (instead of a fresh filesystem glob) and then narrow to$(PlatformsProjectFolder). - Add MSBuild unit test coverage for the compile-removal bucket isolation regression and for dual-path backend activation.
Show a summary per file
| File | Description |
|---|---|
| src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs | Adds regression tests covering compile-removal bucket isolation and dual-path backend activation behavior. |
| src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.SingleProject.targets | Fixes compile removal candidate selection to respect cross-item-type batching buckets and avoid filesystem-glob cross-contamination. |
| src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.SingleProject.Before.targets | Updates backend activation defaulting logic so one registration can activate via recognized TPI or neutral MauiActiveBackend. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 1
| <MauiPlatformSpecificFolder | ||
| Update="@(MauiPlatformSpecificFolder)" | ||
| Condition=" '%(MauiPlatformSpecificFolder.ActivationValue)' == '' and '%(MauiPlatformSpecificFolder.BackendIdentity)' != '' and '%(MauiPlatformSpecificFolder.TargetPlatformIdentifier)' == '' and '%(MauiPlatformSpecificFolder.TargetPlatformIdentifiers)' == '' "> | ||
| Condition=" '%(MauiPlatformSpecificFolder.ActivationValue)' == '' and '%(MauiPlatformSpecificFolder.BackendIdentity)' != '' "> |
Contributor
kubaflo
pushed a commit
that referenced
this pull request
Jul 31, 2026
…ompile filtering (#36957) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description of Change This focused follow-up addresses two empirically validated gaps found by the GPT-5.6 Sol post-merge verification of #36654. 1. `BackendIdentity` now defaults `ActivationValue` even when `TargetPlatformIdentifier` or `TargetPlatformIdentifiers` is also present. A single registration can therefore activate through a recognized TPI or through `MauiActiveBackend` on a neutral TFM, while explicit `ActivationValue` and `ActivationProperty` metadata still win. 2. platform Compile removal now starts from the `Compile` items in the `ExcludeFromCurrentConfiguration=true` metadata batch and intersects them with physical `Platforms/**` candidates. A fresh filesystem glob can no longer pull an explicitly false Compile item from another metadata bucket into the removal set. The helper-item removal pattern remains in place, preserving active item order and avoiding remove/re-add duplication. ## Before and After Before this change, a registration such as: ```xml <MauiPlatformSpecificFolder Include="Platforms/MacOS/" TargetPlatformIdentifiers="macos" BackendIdentity="macos" /> ``` worked for recognized TPI `macos` but did not activate on a neutral TFM with `MauiActiveBackend=macos`. It now supports both paths and remains inactive for another recognized TPI or a mismatched backend. Before this change, the presence of any true Compile metadata batch caused a fresh `Platforms/**` glob to include physical files explicitly marked false by a downstream target. Removal is now constrained to the actual true Compile identities under the platform folder. ## Tests The real shipping SingleProject targets are covered by regressions for: - one dual-path macOS registration through recognized TPI and neutral backend activation, plus recognized-TPI and backend mismatch negatives; - two physical platform Compile files in different metadata buckets with no folder allow-list, asserting only the true item is removed and the surviving list is ordered and duplicate-free. Validation: - complete `MSBuildTests.SingleProject_*` matrix: **46 passed, 0 failed**; - new regression matrix: **7 passed, 0 failed**; - `Controls.Build.Tasks.csproj` build: **succeeded with 0 warnings and 0 errors**; - targeted `dotnet format`: completed successfully. The unfiltered local graph is unavailable on this Mac because the platform project graph requires the iOS workload (`NETSDK1147`) and the full BuildTasks solution filter includes .NET Framework 4.7.2 projects without local reference assemblies (`MSB3644`). The workload-neutral matrix above used the repository-pinned .NET 11 SDK with platform TFMs disabled and imported the exact shipping targets. ### Candidate selection and final review #36957 is the selected implementation. Alternatives #36955 and #36956 both fail their own new Windows Helix XAML regression by removing the explicit-false Compile item. This branch uses FullPath/PathLike intersection, passes the expanded 46-case matrix, preserves metadata and duplicate count, handles absolute Compile identities, and skips the platform filesystem glob when no removal batch exists. Neutral activation of built-in backend identities is intentional: #36654 documented that built-ins use the same registration shape and that ActivationValue defaults from BackendIdentity. A dedicated regression now locks that contract. ## Issues Fixed Part of #34099 Part of #35021 Fixes #36650 Follow-up to #36654 --------- Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com> Copilot-Session: ac6265fe-09a0-473c-b3f9-9ec6d6dd97cd Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
This is a focused follow-up to #36654 from GPT-5.6 Sol post-merge verification. It addresses two gaps in the data-driven
MauiPlatformSpecificFolderimplementation related to #34099.TargetPlatformIdentifiersmatch or neutral-TFMMauiActiveBackendselection.Root causes and behavior
Dual-path backend activation
_MauiNormalizePlatformSpecificFolderspreviously derivedActivationValuefromBackendIdentityonly when both singular and plural TPI metadata were empty. A registration such asTargetPlatformIdentifiers="macos" BackendIdentity="macos"therefore worked for a recognized macOS TPI but could not useMauiActiveBackend=macoson a neutral TFM.The normalization now derives the default whenever
ActivationValueis empty, regardless of TPI metadata. ExplicitActivationValueandActivationPropertyvalues remain untouched. The existing recognized-TPI guard still prevents a neutral selector from over-activating the backend on another recognized TPI.Compile metadata bucket isolation
_MauiRemovePlatformCompileItemsbatched on%(Compile.ExcludeFromCurrentConfiguration)but created each batch from a fresh filesystem glob. In thetruebatch, that glob also discovered physical Compile files belonging to a separate explicit-falsemetadata bucket, allowing the false item to be removed unless it was separately allow-listed.Removal candidates now originate from the batched
@(Compile)identities and are narrowed to$(PlatformsProjectFolder). Allow-list matching remains path-like, and the operation does not mutate or reorder surviving Compile items.Tests
Added shipping-target regression coverage in
MSBuildTestsfor:macosregistration activating through recognized TPI and neutralMauiActiveBackendpaths;Validation performed:
ff48f228and pass with this change.ActivationValuecompatibility, design-time unflip, ordering, and duplicate counts.dotnet format --verify-no-changespassed.The full
Controls.Xaml.UnitTestsinvocation could not run locally because restoringMicrosoft.Maui.BuildTasks.slnfrequires the unavailable iOS workload (NETSDK1147). The same shipping targets were therefore exercised directly with the repository-pinned .NET 11 SDK and workload-neutralnet10.0repro projects.Issues Fixed
Related to #34099.
Follow-up to #36654.