Skip to content

Alerts do not display from ctor or OnAppearing when not in a NavPage/Shell #12970

@mattleibow

Description

@mattleibow

Description

Seems that the alerts are fired correctly and then added to the _pendingActions. However, the FlushPendingActions method only fires when the NavigatedTo even is invoked - and this only happens when in a nav page or in shell.

Steps to Reproduce

  1. In the sandbox app
  2. Use this code in the MauiProgram.cs:
	class App : Application
	{
		protected override Window CreateWindow(IActivationState activationState) =>
			new Window(new MainPage());
	}
  1. Use this code in the MainPage.xaml.cs:
	protected override void OnAppearing()
	{
		base.OnAppearing();
		DisplayAlert("A", "B", "C");
	}

Link to public reproduction project repository

maui repo

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, Windows, macOS, Other (Tizen, Linux, etc. not supported by Microsoft directly)

Affected platform versions

All version as this is xplat code

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions