microsoft / microsoft/microsoft-ui-xaml
Navigation remains pending when navigating inside OnNavigatedTo
Nobody has claimed this yet.
- 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:

Expected output:

### 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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