Skip to content

App hangs if PopModalAsync is called after PushModalAsync with single await Task.Yield() #32310

@Bamich

Description

@Bamich

Description

In any project, just add these three lines anywhere. After execution, the screen will be blank, even though it’s expected to remain on the same page we started from.

await Navigation.PushModalAsync(new ContentPage() { Content = new Label() { Text = "Hello!" } }, false);

await Task.Yield();

await Navigation.PopModalAsync();

In fact, this is a very serious bug, since any “unlucky” modal (popup) display completely freezes the entire application, blocking all input.

Also reproduces with Navigation.PopToRootAsync() instead of Navigation.PopModalAsync().

Found on Android API33-36, haven't tested on iOS

Here's what it looks like in the default project template:

private void OnCounterClicked(object? sender, EventArgs e)
        {
			Dispatcher.DispatchAsync(async () =>
			{
				await Navigation.PushModalAsync(new ContentPage() { Content = new Label() { Text = "Hello!" } }, false);

				await Task.Yield();

				await Navigation.PopModalAsync();
			});
		}

Current behavior (The app is blocked. Neither the previous page nor even the content of the modal is visible):

Screen_Recording_20251031_083406.mp4

Expected behavior (The modal appears and disappears quickly. There is a wait for two Task.Yield() here)

Screen_Recording_20251031_083439.mp4

Steps to Reproduce

  1. Add and call these three lines anywhere (for example, in the "Click me" button handler in the newly created MAUI project template in Visual Studio)
  2. The application is blocked with empty screen without any way to exit this state.

Link to public reproduction project repository

No response

Version with bug

9.0.110 SR12

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

No response

Affected platforms

Android

Affected platform versions

Reproduced at least on Android 33, 36

Did you find any workaround?

No

Relevant log output

Metadata

Metadata

Assignees

Labels

area-navigationNavigationPagepartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androids/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions