Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Only for Windows Phone:
If I try to override OnBackButtonPressed and then ask for a confirmation using DisplayAlert, it returns false BEFORE the user respond to it. For DisplayActionSheet, it aways returns a null string.
The dialog is indeed show, but the answer is not handled (as the await already returned).
In Android, works just fine.
Create a XAML NavigationPage, then:
protected override bool OnBackButtonPressed()
Device.BeginInvokeOnMainThread(async () =>
var result = await DisplayAlert("Encerrar sessão", "Tem certeza de que deseja encerrar esta sessão?", "Sim", "Não");
I have further information on this.
The await doesn't work on a DisplayAlert or DisplayActionSheet after changing MainPage in Windows Phone only.
Many other people have this issue to - http://forums.xamarin.com/discussion/30952/displayactionsheet-windows-phone-problem
Some more information on my issue in the forums here - http://forums.xamarin.com/discussion/38579/await-displayalert-not-blocking
The OnBackButtonPressed event must be handled immediately. In cannot be handled asynchronously. The OS does not allow you to delay handle the back button event. If you wish to pop a confirmation dialog (and you REALLY shouldn't) you should simply return true and then manually pop/exit if they accept.
Ok my fault for not reading the exact problem the user has but the DisplayAlert and DisplayActionSheet do have some serious problems awaiting (not in a back button scenario) when you change the MainPage.
I filed another bug here: https://bugzilla.xamarin.com/show_bug.cgi?id=30377