dotnet / dotnet/maui

[Bug] ModalStack is broken (PushModalAsync, PopModalAsync [Android])

Open
#11,270 6 comments 0 reactions 0 assignees View on GitHub
area-controls-modal area-navigation platform/android s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

I am testing the Modal Stack Navigation behavior.

First point, when I am pushing 10 popups rapidly,
The last page on the modal stack is not necessary the one display on front (on the device).

Second point, when I poping with a button all pages one by one rapidly,
I can have at the end an empty modal stack, but still have one or more modal page displayed.

### Steps to Reproduce

1. In MainPage.cs change the click too
```csharp
private void OnPushClicked(object sender, EventArgs e)
{
Application.Current.MainPage.Navigation.PushModalAsync(new MainPage2());
}
```

2. On a second MainPage2.cs
```csharp
private void OnPopClicked(object sender, EventArgs e)
{
Application.Current.MainPage.Navigation.PopModalAsync();
}
```

3. Run and click verry fast on the centered button.
At the end I still have one popup displayed even if the ModalStack is empty
and the PopModalAsync() does not pop anymore.
also the RemovePage() had never removed the specifiq modal page.
It should.

PS: It is really hard to reproduce with good hardware, so please use bad hardware.
If you can not push 10 popups at once it's because you have a too good hardware.

WIth a LENOVO TAB M10, I can reproduce each time.

### Link to public reproduction project repository
I made a reproduction project on .Net7
[https://github.com/Phenek/Maui-Issue/tree/issue/11270](https://github.com/Phenek/Maui-Issue/tree/issue/11270)

### Version with bug

7.0 Release Candidate 2

### Last version that worked well

Unknown/Other

### Affected platforms

Android

### Affected platform versions

Android 11, 12, 13

### Did you find any workaround?

No

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked .NET 7 reproduction project and the MainPage.cs and MainPage2.cs handlers described in the issue. Run it on Android and reproduce rapid PushModalAsync and PopModalAsync calls, especially on the Lenovo Tab M10. Trace the modal stack and displayed pages; done means rapid pushes and pops stay synchronized and RemovePage removes the specified modal page.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.