Repository navigation
Run Label's Controls mapper remap from UseMauiApp so app customizations survive - #40930
Conversation
Since #28357, Label's Controls remap ran from its static constructor, so its ReplaceMapping calls discarded LabelHandler.Mapper customizations that the app registered in MauiProgram before the first Label was created. Run it again from UseMauiApp, guarded so the static constructor doesn't apply it twice. Fixes #40929 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — 1 finding · ⚠️ 1 breaking change
Reviewed commit 10ef5b8.
Warning
Existing apps would look or behave differently without opting in. See the Behavioral Change Disclosure findings at:
See inline comments for details.
| Element.RemapIfNeeded(); | ||
| Application.RemapForControls(); | ||
| VisualElement.RemapIfNeeded(); | ||
| Label.RemapIfNeeded(); |
There was a problem hiding this comment.
[major] Behavioral Change Disclosure - Preserve inherited FlowDirection customizations on iOS/MacCatalyst. An app that calls ViewHandler.ViewMapper.AppendToMapping(nameof(IView.FlowDirection), ...) after UseMauiApp but before its first Label previously received that callback for Labels; with this change those Label callbacks stop running. Label.RemapForControls also appends its Apple FlowDirection mapping, and ModifyMapping immediately captures the inherited delegate and stores a local override on LabelHandler.Mapper. Running it here captures the parent before the app customizes it, permanently shadowing the later parent callback. This is separate from fixing discarded Text/LineBreakMode customizations. Preserve the previous parent-customization behavior, or provide an explicit compatibility opt-in and disclose the change. Add an Apple inherited-key regression case; the new neutral Text/LineBreakMode test cannot detect this.
MAUI Autopilot — Stopped@kubaflo ❌ The last fix round found nothing more it could fix. Decide how to continue, or comment WhyNo fix was published: the push check rejected paths in the branch history even though the new commit ( |
This comment has been minimized.
This comment has been minimized.
|
No pipelines are associated with this pull request. |
…ed PRs) (#40964) <!-- copilot-assessment:v1 --> ### Agent assessment Self-reported assessment, not an independent review. Assessed revision: `4a4404f49fcad2f2a633f42fcb8593d79f41015b` | Dimension | Assessment | Rationale | |---|---|---| | Change confidence | 8.5/10 | ↑ `gh aw compile` passes; pre_activation script stays under the 20.5 KB expression limit.<br>↑ `node --check` passes on pre_activation and next_round.<br>↑ Unchanged-PR guard replayed on 12 real result-labelled PRs: 10 skip, the 2 with new human comments (#40930, #40933) still run.<br>↓ Two-model fix quality and the round cap are not yet observed live. | <!-- /copilot-assessment --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change MAUI Autopilot spent about 38k AI credits in 6 hours (95 runs, about 100 model requests per fix round). This cuts the main drivers: - **Two models per fix round.** GPT-6.2 Sol and MAI Code 2 propose, critique each other and revise; the Claude Opus 5.5 candidate (a separate workflow run per round) is no longer requested. The prompt, triage (a failure is `unrelated` only when both models agree) and docs are updated. The `opus_run` input stays accepted so in-flight Opus runs can still hand back without a dispatch error. - **At most 3 fix rounds per `/review autopilot`.** Some PRs ran 5–8 rounds. After 3 the loop stops with `s/autopilot-needs-maintainer-decision`; another `/review autopilot` allows 3 more. Conflict merges don't count. - **Don't rerun on an unchanged PR.** If the PR already has `s/autopilot-waiting-for-maintainer-review` or `s/autopilot-needs-maintainer-decision` and nothing changed since that result (no new commits, human comments or reviews, no merge conflict), `/review autopilot` replies with a link to the last result instead of starting over. Removing the label forces a run. Related: #40963 stops a tests round that publishes nothing from repeating. Validation: `gh aw compile maui-expert-autopilot`; `node --check` on the changed scripts; replay of the unchanged-PR guard against real PRs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Target Branch
mainnet11, for reviewFor .NET 11 fixes, only a maintainer retargets the approved PR to the active
inflight lane and merges it after CI validates that final base. Do not merge
individual fixes directly into
net11; agents must not retarget or merge.Description of Change
Since #28357,
Label's Controls remap ran only fromLabel's static constructor. The remap usesReplaceMappingforText,LineBreakMode,MaxLines,TextType,TextTransformandFormattedText, which drops whatever is already mapped. An app that customizesLabelHandler.MapperinMauiProgram(afterUseMauiApp) lost those customizations as soon as the firstLabelwas created. In .NET 9 the remap ran insideUseMauiApp, so app customizations layered on top of it.UseMauiApprunsLabel's remap again, right after theVisualElementremap, as it did before [net10.0] Trimmable view handlers #28357.Labelstatic constructor andUseMauiAppboth go throughRemappingHelper.RemapIfNeeded, the guardElementandVisualElementalready use. The remap runs once, whichever comes first.On
net11,AddControlsHandlers()still registersLabelHandlereagerly, so running the remap at startup doesn't root anything that wasn't already rooted.On
main, #40725 and #40728 fix this differently: customization-preserving mappers plus lazy remapping. That change is too large for servicing.CheckBoxuses the same static-constructor pattern forCheckBoxHandler.Mapper'sColorkey. It's left out of this PR to keep it focused.Tests:
LabelMapperCustomizationTestsruns the scenario against fresh copies of the MAUI assemblies in a collectibleAssemblyLoadContext, because theLabeltype initializer only runs once per process. It callsUseMauiApp, appendsTextandLineBreakModemappings, creates aLabel, and checks that both appended mappings run.Validation:
dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter FullyQualifiedName~LabelMapperCustomizationTestsExpected: ["Text", "LineBreakMode"],Actual: []).dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj: passed, 6840 tests, 0 failed, 30 skipped.Issues Fixed
Fixes #40929
Let AI finish this PR