microsoft / microsoft/microsoft-ui-xaml

Navigation remains pending when navigating inside OnNavigatedTo

Open
#10,613 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

When navigating to Page1, and then triggering a navigation to Page2 from within Page1's OnNavigatedTo method, the navigation to Page2 does not occur — the app remains on Page1.
However, if a small delay (Task.Delay(1)) is added before initiating the navigation, it proceeds correctly.

### Steps to reproduce the bug

Run the attached sample

[App1.zip](https://github.com/user-attachments/files/20703166/App1.zip)

### Expected behavior

Navigation to Page2 should occur without requiring any delay.

### Screenshots

Actual output:
![Image](https://github.com/user-attachments/assets/2ec5a424-5c8c-4a0a-ad77-ae768a254b12)

Expected output:
![Image](https://github.com/user-attachments/assets/542a28d6-87fc-4dac-b91e-57a2d953b5fe)

### NuGet package version

None

### Windows version

_No response_

### Additional context

Workaround found:
Inserting a small delay allows navigation to proceed correctly. Without the delay, navigation remains pending.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the attached App1.zip sample and reproduce navigation from Page1 to Page2 inside Page1's OnNavigatedTo method, comparing it with the Task.Delay(1) workaround. Trace the navigation state while the callback runs; done means Page2 opens without requiring a delay.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.