You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Animations] Page transitions, a composable navigation-transition hook and shared elements - #40537
This implements phase 4a (built-in page transitions and the navigation hook they're built on) and the shared elements of phase 4b from #40382, using the spec's names. It doesn't depend on the storyboard PR; StoryboardTransition follows once that lands. It is based on Shiny page transitions, rebuilt on MAUI's navigation managers instead of replacement renderers and wrapped delegates.
API (Microsoft.Maui.Controls.Animations)
Transition types:PageTransition is a closed hierarchy.
Platform and None are shared values that can't be changed.
Each transition has Duration (300 ms by default), Easing and Background.
The subclasses are FadeTransition, SlideTransition (From takes a SlideEdge: Start, End, Top or Bottom, with Start and End following FlowDirection) and ScaleTransition (FromScale).
A type converter accepts Platform, None, Fade, SlideFromEnd, SlideFromStart, SlideFromTop, SlideFromBottom and Scale.
PageTransitions: the attached properties Transition, ModalTransition and TabTransition, and extension overloads for PushAsync, PopAsync, PushModalAsync, PopModalAsync, GoToAsync and Window.ReplacePageAsync. INavigation and Shell gain no members, and existing calls bind exactly as before.
Providers are registered through DI and consulted in order. Each one can handle a navigation, decline it, or suppress its animation.
Each provider receives a NavigationTransitionRequest (kind, both pages, the resolved transition, back or forward, interactive or not, flow direction) and returns a PlatformNavigationTransition, which wraps an iOS animator and interaction controller, an Android Animation, or a Windows NavigationTransitionInfo.
MAUI's own presets are the last provider.
The existing virtual overrides (Android OnCreateNavigationAnimation, Windows GetNavigationTransition) still take precedence.
Which transition runs
An explicit "don't animate" (animated: false) means None.
Then a per-navigation argument.
Then the attached property on the page being shown.
Then the nearest ancestor that sets it: NavigationPage, Shell or Window.
Otherwise Platform.
Going back reverses the transition that actually ran, which is recorded on the navigation entry, unless the PopAsync passes one of its own. Reduced motion turns every transition except Platform into None, and Platform leaves reduced motion to the OS.
Platforms
iOS and Mac Catalyst:
UIViewControllerAnimatedTransitioning for NavigationPage and for both Shell paths (the renderer and the handler).
The edge swipe-back keeps following the finger with presets and with a provider's interaction controller.
Modals go through the transitioning delegate, presented over the page underneath unless the page sets its own presentation style.
Shell tab switches (renderer) and ReplacePageAsync animate.
Shared elements fly as snapshots inside the transition context.
Android:
Fragment animations for NavigationPage and the default Shell handler.
Modal transitions replace the hard-wired slide-up.
ReplacePageAsync animates through the window overlay.
Shared elements fly in the decor overlay.
Windows:
Presets map to the nearest NavigationTransitionInfo (Slide, DrillIn, Entrance, Suppress), so Duration and Easing aren't honored there yet.
Known gaps (open for discussion)
Not wired: the Android compat ShellRenderer, and the legacy iOS NavigationRenderer.
Shell tabs: not wired on Android, on iOS's opt-in ShellHandler, on TabbedPage or on Windows.
Gestures: interactive Android predictive back (open question Q5).
Windows: the two-presenter Composition host, which Duration, Easing, Fade and Scale need. Modals, tabs and root replacement aren't wired either.
Modals: shared elements don't fly during modal navigation.
Tests
Controls.Core.UnitTests/Animations: 89 tests, covering the resolution order, back reversing what ran (including one-off overrides), the provider chain (handle, decline, suppress, order, virtuals winning), the converter strings, RTL slide edges, overload binding, shared-element pairing and Group disambiguation with the missing-match fallback, reduced motion, and completion after the transition.
Xaml.UnitTests (PageTransitionsXaml): 10 tests under Runtime, XamlC and SourceGen.
Controls.DeviceTests (PageTransitions): 9 tests, all passing on an Android API 37 emulator. iOS, Mac Catalyst and Windows weren't run locally.
UI test:Issue6, a HostApp page and an NUnit test. It builds; it hasn't been run locally (no Appium).
The tests fail without the code: each of these changes to the resolver, re-run against the suite, fails tests:
ignoring the per-call argument (6),
ignoring the recorded pop (4),
skipping the providers (6),
dropping reduced motion (2),
skipping the ancestor walk (2).
Notes
This PR shares two hunks with the storyboard PR: the animations XmlnsDefinition and the XamlC EasingTypeConverter fix. Whichever merges second drops them.
Issues Fixed
Contributes to #6 and #40382 (phases 4a and 4b, shared elements).
…gation-transition providers and shared elements
Adds the page-transition API from the animations spec (dotnet#40382, Part G):
PageTransition (Platform, None) with FadeTransition, SlideTransition and ScaleTransition,
the PageTransitions attached properties and per-navigation overloads, SharedTransition,
and INavigationTransitionProvider, a provider chain consulted from the base navigation
virtuals so existing overrides keep precedence. Back navigation reverses the transition
that ran. iOS/Mac Catalyst, Android and Windows navigation managers resolve transitions
through an internal hook; presets run on the platform's navigation animation machinery.
…mlC Easing converter
The XamlC compiled Easing converter looked the Easing type up in the Controls
assembly, but Easing lives in Microsoft.Maui, so any Easing-typed property set
from XAML failed to compile under XamlC with 'Value cannot be null'.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Overlapping Android root replacements can reset an in-progress animation and make the new root jump, while additional transition-handling and test defects remain unresolved.
Adds page-transition presets, a composable navigation-transition provider hook, and shared-element animations to .NET MAUI, advancing phases 4a/4b of #40382 and the navigation scenarios in #6. Platform integration is incremental, with Windows and legacy-handler limitations documented in the PR.
Changes:
Introduces transition APIs, attached properties, per-navigation overloads, and shared-element pairing.
Connects native navigation, modal, tab, and root-replacement paths to transition handling on supported platforms.
Adds unit, XAML, device, and UI tests, and corrects compiled XAML easing resolution.
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 3e04ea4 with a device test instead: the snapshots are native views with no automation ids, so Appium can't see them mid-flight. The device test samples the native alpha during a one-second flight (source hidden, then both restored) and fails with the Android flight disabled. A cancelled iOS pop isn't covered yet; it can't run on the machine this was built on.
Your /review gate couldn't start due to a transient error triggering the pipeline. The command was left unacknowledged so scheduled recovery can retry it automatically; you can also comment /review gate again in a minute.
- Annotate the ConditionalWeakTable helper's TValue for trimming (IL2091 under NativeAOT).
- Scope per-navigation arguments to the page and navigation kind they were staged for,
never stage a pop of the root page, and clear an unconsumed argument when the
navigation ends without clobbering a newer one.
- Record the flow direction a page was shown in and reuse it when going back.
- Reject infinite and NaN FromScale values.
- No shared-element flights under reduced motion; the platform transition is kept.
- Root replacement is outside the provider contract; overlapping ReplacePageAsync
calls on a window finish the running one first.
- iOS Shell: find a popped page through the retained trackers.
- iOS: drive the interactive pop from the edge or the iOS 26 content swipe-back.
- Tests: kind scoping, flow direction on pop, FromScale, reduced-motion heroes;
modal device test skipped on Windows; UI test compares sizes as a ratio.
The reason will be displayed to describe this comment to others. Learn more.
[critical] Logic and Correctness Verification - Every ordinary NavigationPage push/pop now evaluates Shell.Current while looking for an override. With two windows whose roots are NavigationPages, Shell.Current throws InvalidOperationException because no Shell can be selected, so previously working navigation fails even without opting into transitions. With a Shell in another window, this fallback can instead apply that Shell's deferred GoToAsync override to an unrelated NavigationPage and record the wrong transition for its later pop. Resolve the owning Shell from the supplied navigation/pages rather than consulting the global accessor. Add non-Shell multi-window and unrelated-window regression cases.
The reason will be displayed to describe this comment to others. Learn more.
[major] Logic and Correctness Verification - ShellSection.OnPopAsync removes the outgoing page from its logical stack before invoking the native pop. ElementForViewController searches that shortened stack, so this returns null for the outgoing controller. A detail pushed with a one-off SlideTransition therefore pops with Platform instead of reversing the recorded slide; per-pop overrides and shared-element return pairing are also lost. Use the retained controller trackers as a fallback here and in ShellSectionHandler.iOS.cs:426. The new Shell device test expects the slide on pop.
The reason will be displayed to describe this comment to others. Learn more.
[major] Logic and Correctness Verification - NavigationControllerManager.SetupInteractivePopGesture enables InteractiveContentPopGestureRecognizer on iOS/Mac Catalyst 26+, but this driver observes only the edge recognizer. A back swipe starting inside a page with a preset resolves IsInteractive=false and returns an animator without an interaction controller: the pop runs on a timer instead of following the finger and allowing cancellation. Observe both recognizers and drive progress from the one initiating the pop. The added programmatic-navigation tests do not cover this gesture.
The reason will be displayed to describe this comment to others. Learn more.
[major] Logic and Correctness Verification - With reduced motion enabled and only matching SharedTransition.Name values set, the resolver leaves the requested transition as Platform. This still collects heroes and substitutes a FadeTransition, so Android/iOS/Mac Catalyst fly snapshots despite the documented 'nothing morphs' contract. Skip hero pairing under reduced motion before converting Platform into a custom transition. SharedElementsDontFlyUnderReducedMotion sets an explicit SlideTransition, which becomes None and cannot detect this case.
The reason will be displayed to describe this comment to others. Learn more.
[major] Logic and Correctness Verification - The page-keyed pending override survives navigation that never reaches the resolver. Push an already-stacked detail with a FadeTransition: NavigationPage.OnPushAsync returns immediately, leaving the Fade pending. Pop it and push it normally, and the old Fade overrides its current attached transition. Cancelled Shell pushes and unwired Windows modal requests can similarly retain values, and modal/stack forward requests share the same table. Scope overrides to the operation and clear unconsumed entries on completion/failure using a token that cannot remove a newer request. The successful-push reuse test does not exercise these paths.
The reason will be displayed to describe this comment to others. Learn more.
[major] Input and Path Correctness - Caller-supplied ShellNavigationQueryParameters are forwarded through Shell.GoToAsync's IDictionary overload here. That overload constructs ShellRouteParameters without its single-use tracking, so ShellContent.ApplyQueryAttributes cannot remove the delivered objects and a later back navigation reapplies them. For example, navigate to a detail with single-use parameters and a transition, push another page, change the detail's parameter-backed state, then navigate back: the old values overwrite that state again. Preserve the ShellNavigationQueryParameters type when selecting the forwarding overload so parameters remain limited to the requested navigation.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Cross-Platform Behavioral Consistency - UIKit does not request an animator for an unanimated push, so this is not called and the shown transition is not recorded on iOS/Mac Catalyst. Push a fresh detail with an attached FadeTransition using animated:false, change its attached transition to SlideTransition, then pop with animation: iOS uses Slide, whereas Android/Windows resolve the unanimated push and retain the Fade snapshot. A reused page can instead retain an older push's snapshot. Record forward resolution for unanimated pushes too; the shared recording-handler test does not model this missing native callback.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Logic and Correctness Verification - FromScale accepts double.PositiveInfinity. GetPose then evaluates infinity + (1 - infinity) * progress, producing NaN even at progress zero and one, which reaches Android/iOS scale matrices instead of valid geometry. Reject non-finite scales as well as negative values and add an infinity case to the validation test.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Logic and Correctness Verification - ModalPresentAndDismissComplete runs on Windows, but that platform's modal manager never calls PageTransitionResolver or the registered provider. With this ContentPage-root fixture, _requests stays empty and indexing _requests[0] fails even when both modal operations succeed. Restrict the feature-specific provider assertions to wired platforms or add a separate Windows fallback assertion while modal transitions remain staged.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Logic and Correctness Verification - GetRect forwards the native Appium rectangle without density conversion. Android reports physical pixels, whereas DetailTile.HeightRequest=240 uses device-independent units. At density 2, a correctly laid-out tile is about 480 pixels tall and fails this assertion. Normalize the Android height with App.GetDisplayDensity() before comparing it with the requested logical height.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Unresolved issues leave iOS transition state stale after unanimated pushes, expose the window background during root replacements, and allow overlapping Shell calls to overwrite per-navigation transitions.
On iOS and Mac Catalyst, an unanimated push skips this callback and leaves the recorded transition and flow direction stale. If a page is pushed with Fade, popped, then reused with Slide and animated: false, its next animated pop still uses the old Fade snapshot. Resolve and record every push at the navigation-request boundary, including unanimated pushes, and let this callback consume the prepared result without resolving it again.
Keep incoming root opaque during Fade and Scale replacements
During root replacement, Fade makes the incoming root partly transparent while fading the outgoing snapshot above it, exposing the window background: at halfway, two opaque white pages over black render at only 75% white. Scale has the same unwanted transparency where the two pages overlap. Keep the incoming root opaque while preserving its translation and scale, and fade only the outgoing snapshot.
Scope transition overrides to individual navigation operations
The override is stored once per Shell, so an overlapping call can replace the transition of a navigation that is still waiting or deferred. If the newer call fails and removes its override, the earlier call also loses its per-navigation transition; otherwise it can use the newer call's transition. Associate the override with the individual navigation operation, or serialize these overloads before installing it.
Test shared-element flights during and after transitions
No added test asserts that the native shared-element flight actually runs. SharedTransitionTests verifies pairing only, the device tests use untagged labels, and Issue6 checks final rectangles and navigation status, which remain correct if HeroFlight.Prepare/HeroFlights.Start is skipped entirely. Add a device test that observes snapshots and hidden real elements during the transition, then checks native opacity and overlay cleanup after completion and a cancelled iOS pop.
- Never consult Shell.Current: only a Shell that owns the page (or the destination
page) can supply a GoToAsync override, so several NavigationPage windows don't throw
and another window's Shell can't leak its override.
- Android shared elements fly in the overlay of the window the pages are in (a modal
dialog's included), keep the observer they subscribed to, and put the pictures and
hidden sources back if the window goes away before the flight starts.
- GoToAsync(state, transition, parameters) keeps ShellNavigationQueryParameters single-use.
- iOS/Mac Catalyst: resolve and record unanimated pushes and pops, which UIKit never
asks an animator for, so going back reverses what the page was shown with.
- Tests: multi-window and unrelated-window resolution, single-use parameters with a
transition, unanimated push recording (device), and assertions on the resolved
transition rather than the platform result.
… state, request scopes, More-tab navigation
Native state a transition captures vs later managed writes
- ManagedViewState: after a transition puts back the native state it captured, every managed value that changed
meanwhile (Opacity, IsVisible, the transform properties) is mapped again through the element's handler. Used by
the iOS root replacement and the iOS push/pop animator, so a binding that changes the incoming page's Opacity or
translation mid-transition is no longer overwritten.
- Shared elements are hidden through native visibility (UIView.Hidden, View.Visibility) instead of alpha on iOS and
Android, so an Opacity change during the flight can't reveal the real element under its snapshot; landing puts
the captured visibility back, or maps IsVisible again if it changed.
- The iOS root replacement removes only the animations it added to the incoming root, never the root's own.
Shell request scopes
- Every Shell request has a scope: one without a transition masks an enclosing request's, so a GoToAsync started
from another's Navigated handler no longer takes (or stages) that request's transition.
- The request's scopes are carried explicitly across the dispatches in ShellNavigationManager, as Android's
dispatcher posts a bare callback that doesn't flow the execution context.
Root replacement ordering
- A replacement queued behind another assignment (started from Window.PropertyChanging) ignores that earlier
assignment finishing, and waits for its own page to land before animating.
iOS Shell More tab (opt-in handler)
- Push, pop and pop-to-root on the More controller go through one path: unanimated ones are reported to the
transition hooks (so PushAsync(page, None) is recorded for the pop), and pop-to-root waits for a running
transition before completing and disposing pages.
- The More delegate maps view controllers through the section's root-aware mapping, so a shared element on the
overflow section's root flies.
Windows
- A preset navigation no longer walks the pages for shared elements WinUI doesn't fly.
Tests
- Unit: request masking, the dispatch boundary, queued root replacements, Windows hero discovery, deferred modal
presentation and dismissal replaying their saved transitions, ManagedViewState.
- Device (compiled): opacity during a flight, iOS overlapping and queued root replacements, opacity and own
animations kept across a root replacement, hero snapshots removed on completion and cancellation, and More-tab
completion, Platform timing, unanimated recording and root heroes under both iOS Shell implementations.
GPT-6.2 Sol: Run targeted UI coverage for page transitions, Shell routing, modal navigation, and window root replacement on all four platforms. MAI Code 2: Cross-platform page-transition feature; run Navigation, Shell, and Window UI coverage on all four platforms.
🧪 Ran — 5 categories on Android, iOS, MacCatalyst, Windows
Platform
Categories
Android
Lifecycle, Navigation, Shell1, Shell2
iOS
Lifecycle, Navigation, Shell1, Shell2, Window
MacCatalyst
Lifecycle, Navigation, Shell1, Shell2, Window
Windows
Lifecycle, Navigation, Shell1, Shell2, Window
📊 Results — failed: 22 passed, 1 failed of 23 jobs
GPT-6.2 Sol: Run the new PageTransitions device tests and focused navigation, modal, Shell, window, and lifecycle coverage on all four platforms. MAI Code 2: Run transition-specific, navigation, modal, Shell, Window, and lifecycle device coverage on all platforms.
🧪 Ran — 7 categories on Android, iOS, MacCatalyst, Windows
Each skipped platform and category is listed as a Skippedmaui-pr-uitests (skipped) … check on this commit. Use /azp run maui-pr-uitests for the full suite.
Each skipped platform and project is listed as a Skippedmaui-pr-devicetests (skipped) … check on this commit. Use /azp run maui-pr-devicetests for the full suite.
🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)
UI tests
Each model chose independently; every test that runs was selected by at least one of them.
Platform
GPT-6.2 Sol
MAI Code 2
Android
Navigation, Shell1, Shell2, Lifecycle
Navigation, Shell1, Shell2
iOS
Navigation, Shell1, Shell2, Window, Lifecycle
Navigation, Shell1, Shell2, Window
MacCatalyst
Navigation, Shell1, Shell2, Window, Lifecycle
Navigation, Shell1, Shell2, Window
Windows
Navigation, Shell1, Shell2, Window, Lifecycle
Navigation, Shell1, Shell2, Window
GPT-6.2 Sol — Run targeted UI coverage for page transitions, Shell routing, modal navigation, and window root replacement on all four platforms.
Issue6 and stack/modal managers: Navigation on all four platforms.
Shell routing and tab transitions: both Shell shards.
Root swaps and modal events: Window where runnable and Lifecycle.
Startup only installs the navigation hook; no wider run.
MAI Code 2 — Cross-platform page-transition feature; run Navigation, Shell, and Window UI coverage on all four platforms.
The new Issue6 shared-element/page-transition test is categorized Navigation and runnable on every platform.
NavigationPage, modal, stack, and platform transition managers changed across Android, iOS/Mac Catalyst, and Windows, so Navigation is required on all platforms.
Shell stack navigation and iOS/Mac Catalyst tab switching changed, with cross-platform Shell APIs and transition resolution, so the Shell umbrella is required.
Window.ReplacePageAsync and root-page transitions are newly implemented, so Window coverage is coupled to the feature; unrelated control categories and a full run are unnecessary.
Device tests
Each model chose independently; every test that runs was selected by at least one of them.
GPT-6.2 Sol — Run the new PageTransitions device tests and focused navigation, modal, Shell, window, and lifecycle coverage on all four platforms.
PageTransitionsTests adds native transition and provider coverage.
Stack managers and NavigationViewHandler affect both NavigationPage units.
Modal and Shell handlers affect their own units.
Root replacement and modal events affect Window and Lifecycle, not base handlers.
MAI Code 2 — Run transition-specific, navigation, modal, Shell, Window, and lifecycle device coverage on all platforms.
The changed PageTransitions device tests are in Controls.PageTransitions and directly exercise presets, shared elements, modal transitions, Shell navigation, and root replacement; always include this unit.
Core and Controls NavigationPage handlers/managers changed, requiring Core.NavigationPage and Controls.NavigationPage on every affected platform.
Modal navigation managers changed and the new tests cover present/dismiss transitions, requiring Controls.Modal.
Root-page replacement observes Window page and destruction state, requiring Controls.Window and Controls.Lifecycle; no Graphics/Essentials or full-suite run is needed.
Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.
…a Border
A Label's WinUI TextBlock is only as tall as its text, so Appium reported its height rather than the
240 the element was laid out at. A Border has its own automation peer on WinUI and reports its laid-out
size on every platform.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Android navigation can complete before the incoming animation ends, allowing queued navigation to start prematurely, and modal retries can lose their requested transitions.
The reason will be displayed to describe this comment to others. Learn more.
[major] Memory Leak Prevention - Start ReplacePageAsync(B), then ReplacePageAsync(C) from Window.PropertyChanged for B. The Android and iOS/MacCatalyst helpers can reach WhenAssignedAsync(B) after C has superseded B. B's cleanup task wins Task.WhenAny, but this separate subscription is removed only if B becomes the root again; Untrack removes a different observer. The live window therefore retains B, its page tree and BindingContext indefinitely. Dispose/cancel this waiter when cleanup or supersession wins. The overlapping-root tests check completion and native state, not collection of B.
The reason will be displayed to describe this comment to others. Learn more.
[major] Logic and Correctness Verification - A deferred modal presentation clears its saved transition before presentation succeeds. Queue a per-call Fade while the backend is not ready, then let the first presentation consume the restaged override and throw. PushModalWithOverrideAsync restores the platform stack and leaves the logical request for retry, but its Transition is now null. RequestSync retries with the attached/default transition instead of Fade. Keep the saved snapshot until successful presentation. DeferredPresentationReplaysItsSavedTransition covers only successful replay; add consume-then-fail/retry coverage.
The reason will be displayed to describe this comment to others. Learn more.
[major] Logic and Correctness Verification - An inline modal dismissal never saves its per-call override because this capture requires !applyNow. Present with Slide, request PopModalAsync(Scale) on a ready backend, and let the backend consume Scale before throwing. PopModalWithOverrideAsync restores the presented modal for reconciliation, but RequestSync retries with the recorded Slide because Scale was consumed and never saved. Preserve retry intent for immediate attempts too, clearing it only after successful dismissal. The failed-pop retry tests assert the animated boolean, not the transition.
The reason will be displayed to describe this comment to others. Learn more.
[major] Navigation & Shell - The top captured here need not be the page Shell eventually pops. With root/A, defer a push of B in Shell.Navigating, then call Navigation.PopAsync(Scale) and defer that request too. Complete B's push first, then resume the pop. ShellNavigationManager recomputes the relative pop and removes B, but Scale was staged on A; B reverses its recorded transition instead. Carry the override with the pop request and attach it after the outgoing page is selected, as the modal-pop overload does. The current concurrency tests do not cover this deferral ordering.
The reason will be displayed to describe this comment to others. Learn more.
[major] Logic and Correctness Verification - GetVisualChildren exposes logical children, including every TabbedPage tab; inactive tabs normally remain IsVisible=true. Push a detail from a TabbedPage whose active and inactive tabs each contain a hero named photo, with one matching detail hero and no Group. Walk collects both source heroes and Pick rejects them as ambiguous, so the visible active-tab hero never flies on Android/iOS/MacCatalyst. Traverse only the displayed page of page containers before deciding uniqueness. Pairing tests cover explicitly hidden layouts, not inactive tabs.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Native Platform Defaults Preservation - UIView.Transform captures only an affine transform, not the full Layer.Transform. A custom page handler with a native CATransform3D Y rotation and perspective loses those components when ApplyPose writes UIView.Transform; Finish restores only the affine capture. RootPageTransition.iOS uses the same capture/application pattern. With unchanged managed properties, ReapplyChanged does nothing, leaving the native 3D configuration lost after completion or cancellation. Preserve and compose the full native transform; identity-transform tests do not cover this configuration.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Native Platform Defaults Preservation - On Android API 23-27 this always records HasPivot=true, even when android:id/content uses its native automatic center pivot. Pose sets an explicit pivot and Restore writes the captured coordinates, permanently replacing automatic centering. After an animated ReplacePageAsync followed by a window resize or rotation, a native scale/rotation uses the old center instead of the new one. Preserve automatic-pivot behavior on these supported versions; the API 28+ ResetPivot branch alone does not cover them. The root tests do not resize afterwards.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Android Platform Specifics - Pose replaces the content view's existing pivot with the center while retaining its scale and translation. If the Activity configured android.R.id.content with ScaleX=0.8 and PivotX=0, even a Fade root replacement shifts the live content horizontally by 0.1 times its width: the fade adds no scale or translation, but changing the pivot changes the existing scale's origin. Cleanup restores the original pivot and the root jumps back. Preserve the original pivot or compensate translation when composing the transition.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Performance-Critical Path Optimization - Ordinary animated push/pop with no transition properties or shared-element names now synchronously walks the outgoing page's entire visible tree before keeping the platform animation. FindPairs calls Collect/Walk even when neither page uses shared elements, adding descendant-count-dependent UI-thread work and child-collection allocations to navigation from a large ScrollView/BindableLayout. This also happens in Windows' Platform branch despite presetsCarryHeroes=false. Track shared-element registration with suitable invalidation so pages with none can bypass discovery; current default-transition tests verify selection, not traversal.
The reason will be displayed to describe this comment to others. Learn more.
[moderate] Memory Leak Prevention - Each deferred-dismissal attempt inserts a pending entry, but a throwing PopModalPlatformAsync skips DropPending. With an external backend that does not consume the built-in resolver, a failed attempt followed by a successful RequestSync leaves the first entry behind: the success removes only its own newer entry. Repeated failures accumulate obsolete transitions and objects captured by custom Easing delegates for the lifetime of a cached modal. Release each attempt's exact staging token in finally, keeping retry intent separately. The deferred-dismissal test consumes the entry and covers success only.
Resolved the conflicts with main in 6e45fc9943. The six Controls API inventories now include the page-transition and shared-element APIs alongside the ContentButton, Span decoration, and CollectionView scroll-anchor APIs from main. The transition implementation and tests are unchanged by the conflict resolution.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Failed modal operations can lose one-off transition overrides on retry, while root replacements can discard iOS 3D transforms and leave superseded-page handlers subscribed.
The review bot you guys are using is insane. My agent went back and forth with copilot all day yesterday. The feature is already done and working elsewhere. It shouldn't be such a big deal here - tests are passing.
…k and shared elements (dotnet#40537)
### Target Branch
| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
- [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
This implements **phase 4a** (built-in page transitions and the
navigation hook they're built on) and the **shared elements of phase
4b** from dotnet#40382, using the spec's names. It doesn't depend on the
storyboard PR; `StoryboardTransition` follows once that lands. It is
based on [Shiny page
transitions](https://shinylib.net/controls/page-transitions/), rebuilt
on MAUI's navigation managers instead of replacement renderers and
wrapped delegates.
#### API (`Microsoft.Maui.Controls.Animations`)
- **Transition types:** `PageTransition` is a closed hierarchy.
- `Platform` and `None` are shared values that can't be changed.
- Each transition has `Duration` (300 ms by default), `Easing` and
`Background`.
- The subclasses are `FadeTransition`, `SlideTransition` (`From` takes a
`SlideEdge`: Start, End, Top or Bottom, with Start and End following
`FlowDirection`) and `ScaleTransition` (`FromScale`).
- A type converter accepts `Platform`, `None`, `Fade`, `SlideFromEnd`,
`SlideFromStart`, `SlideFromTop`, `SlideFromBottom` and `Scale`.
- **`PageTransitions`:** the attached properties `Transition`,
`ModalTransition` and `TabTransition`, and extension overloads for
`PushAsync`, `PopAsync`, `PushModalAsync`, `PopModalAsync`, `GoToAsync`
and `Window.ReplacePageAsync`. `INavigation` and `Shell` gain no
members, and existing calls bind exactly as before.
- **`SharedTransition`:** attached `Name` and `Group`.
- **Navigation hook:** `INavigationTransitionProvider` replaces renderer
subclassing.
- Providers are registered through DI and consulted in order. Each one
can handle a navigation, decline it, or suppress its animation.
- Each provider receives a `NavigationTransitionRequest` (kind, both
pages, the resolved transition, back or forward, interactive or not,
flow direction) and returns a `PlatformNavigationTransition`, which
wraps an iOS animator and interaction controller, an Android
`Animation`, or a Windows `NavigationTransitionInfo`.
- MAUI's own presets are the last provider.
- The existing virtual overrides (Android `OnCreateNavigationAnimation`,
Windows `GetNavigationTransition`) still take precedence.
#### Which transition runs
1. An explicit "don't animate" (`animated: false`) means `None`.
2. Then a per-navigation argument.
3. Then the attached property on the page being shown.
4. Then the nearest ancestor that sets it: `NavigationPage`, `Shell` or
`Window`.
5. Otherwise `Platform`.
Going back reverses the transition that actually ran, which is recorded
on the navigation entry, unless the `PopAsync` passes one of its own.
Reduced motion turns every transition except `Platform` into `None`, and
`Platform` leaves reduced motion to the OS.
#### Platforms
- **iOS and Mac Catalyst:**
- `UIViewControllerAnimatedTransitioning` for `NavigationPage` and for
both Shell paths (the renderer and the handler).
- The edge swipe-back keeps following the finger with presets and with a
provider's interaction controller.
- Modals go through the transitioning delegate, presented over the page
underneath unless the page sets its own presentation style.
- Shell tab switches (renderer) and `ReplacePageAsync` animate.
- Shared elements fly as snapshots inside the transition context.
- **Android:**
- Fragment animations for `NavigationPage` and the default Shell
handler.
- Modal transitions replace the hard-wired slide-up.
- `ReplacePageAsync` animates through the window overlay.
- Shared elements fly in the decor overlay.
- **Windows:**
- Presets map to the nearest `NavigationTransitionInfo` (Slide, DrillIn,
Entrance, Suppress), so `Duration` and `Easing` aren't honored there
yet.
#### Known gaps (open for discussion)
- **Not wired:** the Android compat `ShellRenderer`, and the legacy iOS
`NavigationRenderer`.
- **Shell tabs:** not wired on Android, on iOS's opt-in `ShellHandler`,
on `TabbedPage` or on Windows.
- **Gestures:** interactive Android predictive back (open question Q5).
- **Windows:** the two-presenter Composition host, which `Duration`,
`Easing`, Fade and Scale need. Modals, tabs and root replacement aren't
wired either.
- **Modals:** shared elements don't fly during modal navigation.
### Tests
- **`Controls.Core.UnitTests/Animations`:** 89 tests, covering the
resolution order, back reversing what ran (including one-off overrides),
the provider chain (handle, decline, suppress, order, virtuals winning),
the converter strings, RTL slide edges, overload binding, shared-element
pairing and `Group` disambiguation with the missing-match fallback,
reduced motion, and completion after the transition.
- **`Xaml.UnitTests` (`PageTransitionsXaml`):** 10 tests under Runtime,
XamlC and SourceGen.
- **`Controls.DeviceTests` (`PageTransitions`):** 9 tests, all passing
on an Android API 37 emulator. iOS, Mac Catalyst and Windows weren't run
locally.
- **UI test:** `Issue6`, a HostApp page and an NUnit test. It builds; it
hasn't been run locally (no Appium).
- **The tests fail without the code:** each of these changes to the
resolver, re-run against the suite, fails tests:
- ignoring the per-call argument (6),
- ignoring the recorded pop (4),
- skipping the providers (6),
- dropping reduced motion (2),
- skipping the ancestor walk (2).
### Notes
This PR shares two hunks with the storyboard PR: the animations
`XmlnsDefinition` and the XamlC `EasingTypeConverter` fix. Whichever
merges second drops them.
### Issues Fixed
Contributes to #6 and dotnet#40382 (phases 4a and 4b, shared elements).
---------
Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…0755)
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->
### Target Branch
| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |
- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).
For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.
### Description of Change
Fix the deterministic `PageTransitionsTests` failures on `main`,
including the product defects exposed once the More controller actually
runs the transition.
#### Product fixes
- **Programmatically selected overflow tabs never installed the More
navigation delegate.** UIKit reports the selected section's own
controller, not `MoreNavigationController`, even though it displays that
section inside More. Both Shell implementations now install their
existing delegate for overflow sections when there are more than five
tabs. This enables the custom animator, completion tracking, and
shared-element flights.
- **The compatibility renderer popped the wrong native stack.** Its
pop-to-root operation now targets the overflow section's root on the
active More controller and completes through the same transition-aware
path as a single pop. It also reads the active controller's top page
when recording an unanimated push, so a later pop reverses `None`
instead of the page's configured Fade.
- **The managed transition-coordinator binding rejects a null animation
callback.** Supply a no-op animation callback while registering
completion. Once the missing More delegate was fixed, the original
callback produced `ArgumentNullException: animate` from
`UIViewControllerTransitionCoordinatorWrapper.AnimateAlongsideTransition`.
Native/default More navigation still completes immediately; only custom
page transitions wait for their animation.
#### Corrections to provably invalid test setup
- `WindowHandlerStub` presents a workspace inside the runner's window;
it never replaces `UIWindow.RootViewController`. Root-replacement tests
now use a separate real window with the production content mapper. Their
snapshot probe checks UIKit's native replicant class instead of the CLR
`UIView` wrapper name.
- `Window.PropertyChanged` runs **before** native content mapping.
Install the root's own animation after the assignment, assert that it
exists, and finish the replacement without detaching the root. Detaching
an outgoing root lets UIKit remove its animations independently of
MAUI's cleanup, invalidating the original assertion.
- The destination may not have a handler immediately after `PushAsync`
starts. Wait for its content to load before reading native visibility,
and use a short asynchronous delay when polling so the platform
animation loop can run. The original Android test throws in
`NativeShown` before it can inspect a flight.
- More navigation intentionally completes immediately for an unanimated
push. Wait for the pushed content to load before issuing the next
push/pop-to-root; otherwise UIKit has not yet finished presenting that
controller.
#### Which landing introduced this?
The faulty transition code and tests came from #40537 (`f7d3fc1c99`),
not the storyboard landing #40536 (`c1f549fd52`). Comparing those
commits for all six files changed here produces an **empty diff**. The
tests do not use storyboard animation holds. #40537's recorded checks
include `maui-pr` but no `maui-pr-devicetests` check, so its successful
build was not evidence that these device tests passed.
The supplied main-branch CI window was last green at
[1699752](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1699752)
(`eeda7f80ed`), with the failures present from
[1699985](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1699985)
(`c1f549fd52`) onward, including
[1703407](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703407).
Before implementation, searched open and recently merged PRs across all
bases, including `release/*`, `inflight/*`, and `candidate/*`. Inspected
#40658 (bottom-sheet/modal transitions), #40344 (tab reselection),
#40656 (TabbedPage lifecycle), #40696 (queued animation cancellation),
and #40710 (zero-length tweens); none contains these fixes.
#### Local causal validation
All counts below are **passed / failed**, read from fresh XHarness XML
with exact-class isolation verified. Each platform was measured on
original sources, with the correction, with the correction reverted, and
with it restored. No physical devices were used.
| Phase | iOS 27 simulator | Mac Catalyst | Android API 33 emulator |
| --- | --- | --- | --- |
| Original baseline | 18 / 6 | 18 / 6 | 12 / 1 |
| Fixed | 24 / 0 | 24 / 0 | 13 / 0 |
| Reverted | 18 / 6 | 18 / 6 | 12 / 1 |
| Restored | 24 / 0 | 24 / 0 | 13 / 0 |
The reverted Apple failures are the two root tests and both variants of
the More navigation/shared-element tests. Android reproduces the
destination-handler `NullReferenceException`. The Helix Mac Catalyst
opacity timeout did **not** reproduce locally; that case passed locally
before and after the correction. Final validation additionally passed
**24 / 0 on an iOS 18.5 simulator**.
Commands below were run from an isolated worktree based on `main` at
`6d74c1c0d9`. `.dotnet` contains the SDK pinned by `global.json`
(`12.0.100-alpha.1.26523.103`); Xcode is 27.2.
```bash
export PATH="$PWD/.dotnet:$PATH"
export DOTNET_ROOT="$PWD/.dotnet"
export TMPDIR="$PWD/artifacts/transition-evidence/scratch"
export DOTNET_CLI_USE_MSBUILD_SERVER=0
export MSBUILDDISABLENODEREUSE=1
export DOTNET_ROLL_FORWARD=Major
export HEADLESS=true
```
Preparation — all succeeded:
```bash
dotnet build src/DotNet/DotNet.csproj -p:InstallDotNet=false -p:TreatWarningsAsErrors=false -v:minimal
dotnet workload install ios maccatalyst --skip-manifest-update --verbosity minimal
dotnet build Microsoft.Maui.BuildTasks.slnf -p:TreatWarningsAsErrors=false --disable-build-servers -v:minimal
dotnet tool restore
```
iOS causal runs — original/reverted failed **18/6**; fixed/restored
passed **24/0**:
```bash
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -iOSVersion 27 -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00 -Rebuild
```
Mac Catalyst causal runs — original/reverted failed **18/6**;
fixed/restored passed **24/0**:
```bash
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform maccatalyst -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00 -Rebuild
```
Android causal runs — original/reverted failed **12/1**; fixed/restored
passed **13/0**:
```bash
export EmbedAssembliesIntoApk=true
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform android -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -Timeout 00:10:00 -Rebuild
```
The runner selected `emulator-5556` and passed `--instrumentation
com.microsoft.maui.controls.devicetests.TestInstrumentation`. A separate
read-only API 33 emulator was used after another emulator's unauthorized
ADB transport prevented the initial attempt from running tests.
iOS 18.5 final compatibility check — passed **24/0**:
```bash
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -iOSVersion 18.5 -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00
```
Formatting/checks — passed, with workspace-loading warnings from the
formatter:
```bash
dotnet format whitespace Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/PageTransitions/PageTransitionsTests.cs src/Controls/tests/DeviceTests/Elements/PageTransitions/PageTransitionsTests.iOS.cs --verify-no-changes
git diff --check
```
The full repository formatter was also attempted; it emitted unrelated
analyzer edits and multi-target conflict markers. Those edits were
discarded, and the surgical patch was rebuilt and retested. No unrun CI
check is represented as passing.
### 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. -->
Deterministic main-branch `maui-pr-devicetests` failures described
above; tracked here by the linked failing builds rather than an
unrelated issue number.
### 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>
…e detail hero accessible (#40768)
<!-- 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
Test-only corrections for the Windows page-transition failures
introduced with #40537. No product behavior or platform coverage is
removed.
**Device tests:** the recording-provider assertions assumed that the
host enables animations. Windows reads `UISettings.AnimationsEnabled`;
under reduced motion, `PageTransitionResolver` deliberately converts
presets to `None` and bypasses every provider. An empty recording
collection is therefore expected in that mode, not evidence that Windows
lacks a navigation hook. The Windows `StackNavigationManager` already
invokes the hook for both animated and unanimated requests, and the test
application installs it through `UseMauiApp`.
The fixture now explicitly selects the animation-enabled resolver branch
and restores the previous override after asynchronous teardown, even
when teardown fails. A focused device test also explicitly selects
reduced motion and checks that push/pop still navigate without
consulting providers. This preserves the accessibility contract instead
of changing the product to satisfy animation tests.
**UI test:** `SharedElementLandsAndSourceIsRestoredAfterPop` times out
locating `DetailTile`, not navigating or restoring a flight. The
captured Windows page source already contains `DetailStatus = "Arrived
at 2"` and the hero's child text `"Detail"`, but no `DetailTile`.
`MauiBorderAutomationPeer` intentionally excludes unnamed structural
borders from the control view; `AutomationId` alone does not opt in.
Give the meaningful detail hero a semantic description so Appium can
find the border and measure its own bounds. The existing size,
restoration and repeat-navigation assertions remain unchanged.
WinUI presets intentionally do not host shared-element flights. The
existing device flight tests already exclude Windows for that documented
limitation; this PR adds no skips. The cross-platform UI test continues
to check final layout and navigation on Windows.
Upstream open and recently merged transition PRs were checked before
implementation. #40755 fixes Apple Shell navigation and Apple/Android
test fixtures, not these Windows assumptions.
#### Validation
| Evidence | Device tests | UI tests |
| --- | --- | --- |
| Baseline red | [main build
1703707](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703707),
Windows packaged/unpackaged, logs 960/962 | [main build
1703706](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703706),
Controls Navigation, log 5895 |
| Fix result | PR CI requested; pending | PR CI requested; pending |
| Revert/restore cycle | Not run: no Windows host is available | Not
run: no Windows host is available |
The five baseline device failures are
`PresetPushAndPopCompleteAfterTheTransition`,
`ShellGoToAsyncWithATransition`, `PerNavigationOverloadIsReversedOnPop`,
`ProviderCanSuppressTheAnimation`, and
`UnanimatedPushIsRecordedForThePop`. Raw CI logs and the UI page-source
attachment were inspected; no unavailable AzDO test-results API result
is inferred.
Local host: macOS, repository-pinned SDK `12.0.100-alpha.1.26523.103`.
**No local Windows runtime validation or successful full Windows build
is claimed.** Cross-targeting cannot run the native Windows PRI/XAML
tools on this host; Windows compilation and execution must be confirmed
by PR CI.
Commands and results:
```bash
dotnet build src/Controls/src/Core/Controls.Core.csproj -f net12.0-windows10.0.19041.0 -p:EnableWindowsTargeting=true
```
Failed initially: the host SDK was 11.0.100 (`NETSDK1045`). After
provisioning the pinned SDK, restore also visited uninstalled Apple
workloads. SDK setup succeeded:
```bash
dotnet build src/DotNet/DotNet.csproj -p:InstallWorkloadPacks=false -p:TreatWarningsAsErrors=false -v:q
```
The Windows-only restore attempt failed running `MakePri.exe` with an
exec-format error:
```bash
.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -f net12.0-windows10.0.19041.0 -p:EnableWindowsTargeting=true -p:TargetFrameworks=net12.0-windows10.0.19041.0 -v:q
```
Disabling native PRI generation for a compile attempt reached the native
WinUI XAML compiler, which produced no `output.json`. Both commands
failed with that host limitation:
```bash
.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -f net12.0-windows10.0.19041.0 -p:EnableWindowsTargeting=true -p:TargetFrameworks=net12.0-windows10.0.19041.0 -p:AppxGeneratePriEnabled=false -v:q
.dotnet/dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net12.0-windows10.0.19041.0 -p:EnableWindowsTargeting=true -p:TargetFrameworks=net12.0-windows10.0.19041.0 -p:AppxGeneratePriEnabled=false -v:q
```
The required build tasks were built successfully before the final
device-build attempt:
```bash
.dotnet/dotnet build Microsoft.Maui.BuildTasks.slnf -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeAndroidTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q
```
Portable navigation-transition provider policy tests passed: **15
passed, 0 failed, 0 skipped**. These cover the resolver policy, not
Windows device execution:
```bash
.dotnet/dotnet test --project src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeAndroidTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false --filter-class '*NavigationTransitionProviderTests'
```
Formatting passed with workspace-loading warnings; whitespace validation
passed:
```bash
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/PageTransitions/PageTransitionsTests.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6.cs --exclude Templates/src --exclude-diagnostics CA1822
git diff --check
```
### 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. -->
Addresses the deterministic main-branch CI failures linked above.
Related to #40537 and #40755.
### 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>
…ng the initial navigation (#40795)
<!-- 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!
<!-- copilot-assessment:v1 -->
### Agent assessment
Self-reported assessment, not an independent review.
Assessed revision: `d1f1c3803dfb83a81deaeedf0fcc19a3919871a0`
| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 8/10 | ↑ Red/green/revert/restore on macOS: the
added unit test fails on net11 without the guard (Expected 0, Actual 1),
passes with it, fails again when reverted, passes when restored.<br>↑
317 Controls.Core.UnitTests navigation tests pass with the guard.<br>↑
Same 8-line guard that is already on main, where the Windows
NavigationPage category passes.<br>↓ Windows device tests not run
locally (macOS host); CI is the validation. |
| Diagnosis confidence | 6/10 | ↑ The race is real and reproduced
deterministically by the unit test.<br>↑ The failing Windows test
(SettingTitleIconImageSourceDoesntCrash) pushes a NavigationPage right
after the handler connects, the exact scenario.<br>↓ The Windows host
crash has no managed stack or dump, so the link between this race and
the crash is inferred from main passing and net11 not, not observed
directly. |
| Evidence fit | 6/10 | ↑ The crash reproduces on every net11 run
(packaged and unpackaged, two heads) and not on main, where only this
guard differs in the navigation path.<br>↓ Not confirmed until
maui-pr-uitests runs on this PR; if NavigationPage still crashes the
diagnosis is wrong. |
<!-- /copilot-assessment -->
### Target Branch
- [x] I selected the applicable base branch (`net11`, .NET 11 fix, for
review).
### Description of Change
Backports the `NavigationPage.cs` hunk and its unit test from #40537
(already on `main`).
When the handler connects, `NavigationPage` starts an initial navigation
whose completion callback called `SendNavigated(null, ...)`, which reads
`CurrentPage`. If a page is pushed right after the handler connects,
`CurrentPage` is already the pushed page by the time the callback runs,
so its `NavigatedTo` is raised before its own navigation has run. The
callback now only sends the initial `Navigated` when `CurrentPage` is
still the page that navigation was for; the pushed page gets its
`NavigatedTo` from its own navigation.
This is the scenario of the Windows device test
`SettingTitleIconImageSourceDoesntCrash`, which pushes a
`NavigationPage` right after the window handler is created. That test
crashes the test host (exit 7, no managed stack) on every `net11` run of
maui-pr-uitests (build 1703903, packaged and unpackaged) and passes on
`main`, where this guard is present.
Validation (macOS, `Controls.Core.UnitTests`, net11.0):
- Baseline, test only:
`APushMadeBeforeTheInitialNavigationFinishesGetsNavigatedToOnlyFromItsOwnNavigation`
fails (Expected 0, Actual 1).
- With the guard: passes; `NavigationPageLifecycleTests` 10/10.
- Guard reverted: fails again (Actual 1).
- Guard restored: passes; navigation tests 317/317.
Not run locally: the Windows device test (Windows-only); maui-pr-uitests
on this PR is the validation.
### Issues Fixed
Fixes the NavigationPage host crash in maui-pr-uitests on `net11`.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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
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.
Target Branch
mainDescription of Change
This implements phase 4a (built-in page transitions and the navigation hook they're built on) and the shared elements of phase 4b from #40382, using the spec's names. It doesn't depend on the storyboard PR;
StoryboardTransitionfollows once that lands. It is based on Shiny page transitions, rebuilt on MAUI's navigation managers instead of replacement renderers and wrapped delegates.API (
Microsoft.Maui.Controls.Animations)PageTransitionis a closed hierarchy.PlatformandNoneare shared values that can't be changed.Duration(300 ms by default),EasingandBackground.FadeTransition,SlideTransition(Fromtakes aSlideEdge: Start, End, Top or Bottom, with Start and End followingFlowDirection) andScaleTransition(FromScale).Platform,None,Fade,SlideFromEnd,SlideFromStart,SlideFromTop,SlideFromBottomandScale.PageTransitions: the attached propertiesTransition,ModalTransitionandTabTransition, and extension overloads forPushAsync,PopAsync,PushModalAsync,PopModalAsync,GoToAsyncandWindow.ReplacePageAsync.INavigationandShellgain no members, and existing calls bind exactly as before.SharedTransition: attachedNameandGroup.INavigationTransitionProviderreplaces renderer subclassing.NavigationTransitionRequest(kind, both pages, the resolved transition, back or forward, interactive or not, flow direction) and returns aPlatformNavigationTransition, which wraps an iOS animator and interaction controller, an AndroidAnimation, or a WindowsNavigationTransitionInfo.OnCreateNavigationAnimation, WindowsGetNavigationTransition) still take precedence.Which transition runs
animated: false) meansNone.NavigationPage,ShellorWindow.Platform.Going back reverses the transition that actually ran, which is recorded on the navigation entry, unless the
PopAsyncpasses one of its own. Reduced motion turns every transition exceptPlatformintoNone, andPlatformleaves reduced motion to the OS.Platforms
UIViewControllerAnimatedTransitioningforNavigationPageand for both Shell paths (the renderer and the handler).ReplacePageAsyncanimate.NavigationPageand the default Shell handler.ReplacePageAsyncanimates through the window overlay.NavigationTransitionInfo(Slide, DrillIn, Entrance, Suppress), soDurationandEasingaren't honored there yet.Known gaps (open for discussion)
ShellRenderer, and the legacy iOSNavigationRenderer.ShellHandler, onTabbedPageor on Windows.Duration,Easing, Fade and Scale need. Modals, tabs and root replacement aren't wired either.Tests
Controls.Core.UnitTests/Animations: 89 tests, covering the resolution order, back reversing what ran (including one-off overrides), the provider chain (handle, decline, suppress, order, virtuals winning), the converter strings, RTL slide edges, overload binding, shared-element pairing andGroupdisambiguation with the missing-match fallback, reduced motion, and completion after the transition.Xaml.UnitTests(PageTransitionsXaml): 10 tests under Runtime, XamlC and SourceGen.Controls.DeviceTests(PageTransitions): 9 tests, all passing on an Android API 37 emulator. iOS, Mac Catalyst and Windows weren't run locally.Issue6, a HostApp page and an NUnit test. It builds; it hasn't been run locally (no Appium).Notes
This PR shares two hunks with the storyboard PR: the animations
XmlnsDefinitionand the XamlCEasingTypeConverterfix. Whichever merges second drops them.Issues Fixed
Contributes to #6 and #40382 (phases 4a and 4b, shared elements).