Skip to content

Frame.Navigated and page's OnNavigatedTo fire in a different order on android than on uwp. #1863

Closed

Description

@DysnomianC

Current behavior

On uwp the Frame.Navigated event fires before OnNavigatedTo. On android they fire in the other order.

This was the cause of a difficult to track down bug in our project as we relied on setup that was done in the Frame Navigated event during the OnNavigatedTo page override. We can currently work around this issue by using some messy conditional compilation but this issue makes it difficult to port existing apps from uwp.

Expected behavior

For Frame Navigated to fire before OnNavigatedTo on android.

How to reproduce it (as minimally and precisely as possible)

Run the sample project.
NavTest.zip
Notice that in the debug log "Frame Navigated" and "OnNavigatedTo" are printed in a different order on android than uwp.

Environment

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • Windows
  • Build tasks
  • Solution Templates

Visual Studio:

  • 2019 (version: 16.3.5)

Relevant plugins:
Uno Platform Solution Templates - 1.45.0.1865

Anything else we need to know?

Activity

  1. added
    kind/bug
    triage/untriaged
    on Oct 16, 2019
  2. added
    platform/android 🤖
    on Oct 16, 2019
  3. added and removed
    triage/untriaged
    on Oct 16, 2019
  4. MartinZikmund commented on Oct 16, 2019

    @MartinZikmund
    Member

    I will have look at this

  5. removed their assignment
    on Oct 31, 2019
  6. MartinZikmund commented on Oct 31, 2019

    @MartinZikmund
    Member

    I let my brother do this one, so he can try developing on Uno as well 😀

  7. added this to the 3.1 milestone on Aug 29, 2020
  8. jeromelaban commented on Aug 31, 2020

    @jeromelaban
    Member

    Closing as a duplicate of #1863

  9. modified the milestones: 3.1, HighPriority on Sep 1, 2020
  10. 4 remaining items

  11. modified the milestones: 3.1, 3.2 on Sep 28, 2020
  12. DierkDroth commented on Oct 14, 2020

    @DierkDroth

    @jeromelaban I just confirmed on iOS that the problem is even more widespread: .Loading and .Loaded is fired before .OnNavigatedTo which is wrong: on UWP they are fired after.

    This raises a serious problem: with NavigationEventArgs in .OnNavigatedTo I'm supposed to pass "parameters" to the new frame. I needed those "parameters" when processing .Loading and/or .Loaded. What workaround would there be available.

    BTW: believe the same problem exists on WASM

  13. MartinZikmund commented on Oct 14, 2020

    @MartinZikmund
    Member

    @DierkDroth yes we are aware of this one - #2872 and #2895. It is however quite complex issue, so it will require quite a bit of work across all platforms

  14. removed this from the 3.2 milestone on Oct 19, 2020
  15. added
    difficulty/tbd
    on Feb 15, 2021
  16. added
    difficulty/challenging 🤯
    difficulty/starter 🚀
    and removed
    difficulty/tbd
    difficulty/challenging 🤯
    on Jun 1, 2021
  17. changed the title [-]Frame.Navigated and page's OnNavigatedTo fire in a different order on android than on uwp.[/-] [+]`Frame.Navigated` and page's `OnNavigatedTo` fire in a different order on android than on uwp.[/+] on Jun 2, 2023
  18. MartinZikmund commented on Jun 2, 2023

    @MartinZikmund
    Member

    This part of navigation lifecycle was adjusted in #9251

  19. added a commit that references this issue on Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty/starter 🚀kind/bugplatform/android 🤖project/navigation-lifecycle 🧬

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions