Repository navigation
[Validation only - do not merge] #33561 + #40666 - #40667
simonrozsival wants to merge 36 commits into
Conversation
Squashed for clean rebase.
- Inline the lazy initialization lock+check directly into IStyle.Apply - Remove the internal InitializeIfNeeded method (was only needed for tests) - Update tests to use ((IStyle)style).Apply() instead of InitializeIfNeeded Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- CanBeAppliedTo: add null check after BaseType walk (reaches null at top of hierarchy before hitting Element) - TargetTypeFullName: guard against Type.FullName being null for generic/special types; fall through to AQN parsing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- PublicAPI net-ios/net-maccatalyst: remove duplicate ShellFlyoutRenderer entry - Revert whitespace-only changes in 3 SourceGen test snapshot files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace 6 occurrences of ((IStyle)style).Apply(target, new SetterSpecificity()) with style.ForceInitialize(target) extension method. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- SetPropertiesVisitor: remove duplicate variable declarations and duplicate getNodeValue delegate from rebase conflict - SetNamescopesAndRegisterNames: remove duplicate if-statement, keep TryGetValue guard for nodes not in Variables - Style.CanBeAppliedTo: guard against null Type.FullName Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Change TargetTypeFullName from ReadOnlySpan<char> to string, removing #if NETSTANDARD branching and Span-based comparisons - Use plain string equality in CanBeAppliedTo instead of SequenceEqual - Remove redundant .ToString() call in ResourceDictionary.Add - Revert unrelated maps PublicAPI.Unshipped.txt changes from rebase Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename parentVar in nested scope to avoid CS0136. Add StringComparison.Ordinal to IndexOf call to satisfy CA1307. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- SetPropertiesVisitor.cs: Use Context property (not primary ctor param) since this class uses a regular constructor - Style.cs: Remove StringComparison.Ordinal from char IndexOf overload for netstandard2.0 compatibility Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- StyleSourceGenTests: Reorder __root before style in snapshots to match upstream SourceGen visit order change - SetterCompiledConverters, SimplifyOnPlatform, Maui32879: Convert fragile full-snapshot tests to assertion-based tests validating the trimmable style pattern (string ctor, LazyInitialization, setters) - LazyStyleTestHelper: Call LazyInitialization directly instead of IStyle.Apply to avoid InvalidCastException when style target type differs from the test element type Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Implement the style visitor contract on the OnIdiom inference pass added on net11.0, keeping its traversal of style content unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fix correctness issues found in review:
- Defer style content with a top-down pre-pass
(MarkDeferredStyleContentVisitor). Visitors skip only the content
properties of deferred styles, so the style's own properties,
diagnostics and Hot Reload registration still run. Inline BasedOn
styles get their own lazy initializer.
- Fall back to an eager Style(Type) for runtime TargetType values
such as {x:Static}.
- Only apply a SourceGen-built style to instances of its TargetType.
A mismatched element gets nothing and the mismatch is logged
(element logger, app logger, then Trace). Rejected targets are not
tracked, re-entrant applies during initialization are queued, and
XAML setters keep precedence over setters added from code.
- Report MAUIX2024 when a same-file {StaticResource} style's
TargetType does not match the element.
- Generate the initializer as a local function wrapped in an explicit
delegate. A non-capturing lambda adds a cached-delegate field, which
later Hot Reload updates cannot add.
- Add MauiXamlTrimmableStyles (and per-file TrimmableStyles metadata)
to restore eager styles.
Document the behavior in docs/trimmable-styles-spec.md.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The Docs: Spellcheck job runs when a PR changes docs/. It flagged "Trimmable" in docs/trimmable-styles-spec.md and "Emscripten" in docs/DevelopmentTips.md, which reached main in #40122 without the check running. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Only NativeAOT removes the setters behind the generated `is T` check. ILLink keeps them: a trimmed (non-AOT) publish kept the unused style's control and payload, just like an eager style. So MauiXamlTrimmableStyles now defaults to $(PublishAot), and the generator creates eager styles when the property is not set. Generated styles now use `new Style(typeof(T))`. With NativeAOT, typeof(T) keeps only T's type descriptor (316 bytes in the sample app) and the guarded setters are still removed. This drops the Style(string) constructor, Type.GetType and its IL2057 suppression, the nullable TargetType and name-based matching. Implicit-style keys stay strings. Fix Hot Reload replacing the setters of a lazy style that has not been applied yet: its first apply added the stale XAML setters back. The initializer's setters are now discarded in that case; its triggers and behaviors are kept. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…spec Setting PublishAot for only some configurations is an app configuration choice, not something this feature needs to document. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Microsoft.CodeAnalysis.Analyzers 5.12.0 (#40641) adds RS1038, which fails every UI test build because UITest.Analyzers references Microsoft.CodeAnalysis.CSharp.Workspaces for its code fix providers. The analyzer types don't use Workspaces APIs, so the compiler can load and run them without Workspaces; the code fixes are only loaded by IDEs, which provide it. The assembly is test-only and isn't shipped. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
#40387 made the nested _17521CatDetailsPage and _33356CatDetailsPage partial but not their containing Shell types. The QueryProperty generator skips such types, so navigating to them throws at runtime on every platform. On Windows the build also fails with CS0260: the CsWinRT 2.1.2 AOT generator in the pinned Windows SDK projection (10.0.19041.44) emits a partial declaration of the containing type for nested partial classes that implement INotifyPropertyChanged. Newer CsWinRT versions skip types with non-partial containers. ShellSearchControlPage.SearchDetailPage wasn't partial either, so its query property throws at runtime in the same way. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
No call in ApplyLegacyQueryProperties or ValidateGeneratedQueryProperties requires unreferenced code, so ILLink reports IL2121 for the IL2026 suppressions. iOS trimmed builds report IL2121, which fails the RunOniOS_MauiReleaseTrimFull_CoreCLR integration test. The IL2067 and IL2072 suppressions are still used. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
#36581 replaced the Windows ImageProcessor.RotateImageAsync with the shared Graphics-based ImageProcessor, breaking the Windows Essentials device test build (CS0117, followed by WMC0001 because the XAML compiler can't resolve MiddleApp without the C# compile). The Issue38570 test now processes the image through ProcessImageToCacheFileAsync with the options MediaPicker uses for RotateImage = true, and still checks that the stored pixels are rotated exactly once and that the preserved metadata doesn't rotate them again. Processing always writes a new file now, so the unchanged-stream check for orientation 1 no longer applies. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Don't assign fields for x:Name inside a Style. Code-behind declares no field for them, so SetFieldsForXNamesVisitor emitted an assignment to a missing field (CS1061) for eager styles. With trimmable styles the generator crashed instead, because the style content is created later inside the lazy initializer. - Roll back setters, triggers and behaviors added by an initializer that throws, so a later apply doesn't duplicate them. - Keep XAML-declared triggers and behaviors ahead of ones added from code, as already done for setters. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. |
ReparentingChildDuringHandlerCreationKeepsItInNewParent failed on Windows because its GetPlatformParent helper used VisualTreeHelper.GetParent. WinUI's public GetParent returns null for any element that is not in the live visual tree, and the test creates its handlers without adding them to a window. The original label's TextBlock is a child of the destination ContentPanel, but the helper could not see it. Read FrameworkElement.Parent instead. For a panel child it is the panel, whether or not the panel is loaded, and the helper still confirms that the panel's CachedChildren contains the element. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
There was a problem hiding this comment.
🔵 Needs a closer look
Missing cross-platform UI/device CI results prevent this source-only review from establishing compatibility for globally enabled deferred styles and the revised Windows image and detached-tree parent assertions.
3 open issues
Review effort: Balanced
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.
|
|
||
| [QueryProperty(nameof(ItemName), nameof(ItemName))] | ||
| internal sealed class SearchDetailPage : ContentPage | ||
| internal sealed partial class SearchDetailPage : ContentPage |
There was a problem hiding this comment.
[moderate] Regression Prevention and Test Coverage - No active test exercises the detail page fixed here. VerifyShellSearch_SelectedItem and the other search-result navigation tests are ignored for #35767, while the Issue17521/Issue33356 tests navigate different types. Removing this partial declaration would therefore restore the missing generated query-property implementation and make navigation to searchdetail fail without an active regression test detecting it. Add a focused test that navigates directly with ItemName and asserts DetailName, bypassing the unrelated search-result automation failure.
|
Validation findings extracted so far; keeping this PR open until its current full UI run finishes.
Current full UI build 1702158 is still in progress. Closure is deferred so its remaining evidence is not lost. This validation PR must not be merged, and none of these findings is a merge-readiness approval for #33561, #40666, or #40692. |
CI showed that the previous FrameworkElement.Parent-based helper still returned null on Windows. These handlers are never added to a window, and WinUI parent queries do not reliably report parents outside the live tree, so they cannot tell a reporting gap from a real product bug. On Windows, assert the invariant directly: the original label keeps the platform view it had when it moved, the destination ContentPanel's children contain that view, and the button's ContentPanel does not. Each assertion message records the view's Parent, its VisualTreeHelper parent, and both panels' Content and children, both right after the move and at the end, so a failure identifies where the view went. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…idation 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.
There was a problem hiding this comment.
🔵 Needs a closer look
The validation-only branch cannot be cleared for merging without cross-platform CI results covering Windows codec/EXIF behavior, detached WinUI reparenting, and globally enabled lazy styles.
3 open issues
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| [QueryProperty(nameof(ItemName), nameof(ItemName))] | ||
| internal sealed class SearchDetailPage : ContentPage | ||
| internal sealed partial class SearchDetailPage : ContentPage |
There was a problem hiding this comment.
[moderate] Regression Prevention and Test Coverage - The missing query-property implementation fixed here has no active regression coverage. Every ShellSearchHandlerFeatureTests test that navigates to this SearchDetailPage is ignored for #35767; Issue17521/Issue33356 navigate different detail types, and the generator unit tests use synthetic types. Removing this partial declaration therefore makes the generator skip this page and ShellContent throw when applying ItemName on navigation to searchdetail, without an active test detecting the failure on Android, iOS, MacCatalyst or Windows. Add a focused test that navigates directly with ItemName and asserts DetailName, bypassing the unrelated search-result automation failure.
…st (#40692) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change `ContentButtonControlTests.ReparentingChildDuringHandlerCreationKeepsItInNewParent` (added with the native `ContentButton` in #39762) fails on Windows only, packaged and unpackaged, at its last assertion: ``` Assert.Same() Failure: Values are not the same instance Expected: ContentPanel { ..., ActualSize = <0, 0>, ... } Actual: null ``` It never failed on `main`'s CI because Windows device tests have not built there since #36581 (#40666 fixes that build). The test creates its handlers with `CreateHandler`, which never adds them to a window, so none of the WinUI elements are in the live tree. In the original label's `HandlerChanged` callback it swaps the button's content and moves the label into a `ContentView`. The last assertion asked a WinUI parent query whether the label's `TextBlock` is parented to the destination `ContentPanel`: 1. The original helper used `VisualTreeHelper.GetParent`, which [returns null for any element outside the live tree](https://github.com/microsoft/microsoft-ui-xaml/blob/main/dxaml/xcp/dxaml/lib/VisualTreeHelper.cpp) ("Don't return the parent unless we're in the live tree"). So that failure didn't show anything about the product. 2. This PR's first commit switched to `FrameworkElement.Parent`. That still returned `null` on CI (`maui-pr-devicetests` 1702098 on #40667, with product code identical to `main`). Microsoft's docs say `Parent` "can be null if an object was instantiated, but is not attached to an object that eventually connects to a page object root". Static tracing of the product path finds no step that detaches the `TextBlock` or replaces the label's handler. The guarded `ContentButtonHandler.MapContent` returns before touching the label once the content has changed, and `ContentViewHandler.UpdateContent` adds the `TextBlock` to the destination `ContentPanel`. Still, a parent query that reads null off-tree can't tell a reporting gap from a real product bug. The test now checks the invariant directly on Windows instead of asking WinUI for a parent: - the label keeps the platform view it had right after the move; - the destination `ContentPanel`'s children contain that view (checked by enumerating its children and comparing references); - the button's `ContentPanel` does not contain it. A WinUI element can belong to only one parent, so this is as strict as the previous parent check. Each assertion message records the view's `Parent`, its `VisualTreeHelper` parent, and both panels' `Content` and children, captured both right after the move and at the end. If the product is wrong, the failure shows where the view went. Android (`View.Parent`) and iOS (`Superview`) keep the parent assertion, which works outside a window. **Validation** - Windows can't be built or run on the macOS dev machine. The new Windows code was type-checked against the WinUI 2.3.9 reference assemblies in a scratch `net10.0-windows10.0.19041.0` project, with stubs for the internal MAUI types (`dotnet build`: succeeded; a deliberate misspelling was reported as CS1061). The file was also compiled with each of `ANDROID`, `IOS`, `MACCATALYST` and `WINDOWS` defined: the only errors were missing references from compiling outside the device-test project, with no syntax, preprocessor or missing-name errors in the new code. - The Windows device-test result needs CI (`maui-pr-devicetests`) on a branch that includes the build fix from #40666. ### Issues Fixed Fixes a Windows device-test failure in `ContentButtonControlTests` (no separate issue). It was seen in `maui-pr-devicetests` builds 1701680 and 1702098 (#40667) and 1701815 (#40666). ### Let AI finish this PR - [ ] **Let the MAUI agent address review feedback and fix remaining issues on this PR.** Maintainers still decide whether it is merged. For PRs from forks, the agent opens a follow-up PR that keeps your commits. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> 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!
Caution
Validation only. Do not merge. This PR will be closed once CI results are collected.
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
This PR exists only to run full CI, including
maui-pr-uitestsandmaui-pr-devicetests, on #33561 ([XSG] Trimmable Styles) together with the build fixes from #40666.maincurrently has four build breaks (RS1038, CS0260, IL2121 and Essentials Windows CS0117) that stop CI from building the UI tests on every PR. #40666 fixes them, but until it merges, #33561's UI tests cannot run. This branch is #33561's branch (dev/simonrozsival/trimmable-styles) with #40666's branch (simonrozsival-fix-main-ci-build-breaks) merged in with a regular merge commit. It has no other changes.Fixes for any failures go to #33561 or #40666, and this branch is re-merged from them. Neither PR's branch is modified from here.
Issues Fixed
None. Validation only, related to #33561 and #40666.