-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alerts do not display from ctor or OnAppearing when not in a NavPage/Shell #12970
Comments
Same or similar to #12739 |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
any update on this guys? i have the same problem |
Yup, I just hit this one too. |
@mattleibow I find this to be even worse than the title... On Windows, OnNavigatedTo actually fires in my app, but the alert is still not displayed. If you try to work around it by adding an (insufficient) delay by using a timer or a Task.Delay, then it can cause a crash (8.0.0-rc.1.9171):
So, seems like there's a pretty big problem in how to know how when it's valid to display an alert... I can put in a delay of a second, and that works OK on my machine (anything much shorter is unreliable) - but I don't know if it's sufficient for other cases. |
Verified this issue with Visual Studio Enterprise 17.8.0 Preview 2.0. Can repro on windows platform with sample code. |
Just to note here from #12739 that the Page.Loaded event can be hooked instead as a workaround |
This is quite a big issue for me, as I have Try...Catches in OnAppearing that call DisplayAlert to let the user know of issues. |
@Mark-NC001 Coud you queue it on the dispatcher as a workaround? I was able to reorganize to avoid the problem deterministaically via |
Hi, @Mark-NC001 try this as a workaround protected override void OnAppearing()
{
base.OnAppearing();
DisplayAlertOnAppearing("Hello","Message","Ok");
}
void DisplayAlertOnAppearing(string title, string message, string cancel)
{
Loaded += OnLoaded;
void OnLoaded(object sender, EventArgs e)
{
DisplayAlert(title, message, cancel);
Loaded -= OnLoaded;
}
} |
@kubaflo and @jeremy-visionaid thanks for the info. In the end I've made a new function that I call from within OnAppearing, waiting until it's done. I'm preparing myself for the many reasons why I shouldn't do this.....!
Also, it's not just DisplayAlerts that aren't working - I'm also using dependency injection: |
Description
Seems that the alerts are fired correctly and then added to the
_pendingActions
. However, theFlushPendingActions
method only fires when theNavigatedTo
even is invoked - and this only happens when in a nav page or in shell.Steps to Reproduce
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
The text was updated successfully, but these errors were encountered: