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.
Ever since updating to visual studio 2017, Xamarin 126.96.36.1996 and Xamarin.Forms 188.8.131.52, IOS fails to display an alert when paging if the DisplayAlert function is in the main method of said new page, or in a method that is called from the page's main method.
Android works as expected.
I have replicated this by simply creating a new Xamarin.Forms project adding a new page, changing the layout to a navigation page in app.xaml.cs then using Navigation.PushAsync(new Page2()); in a button clicked event.
public Page2 ()
DisplayAlert("Alert","Welcome to Page 2!","OK");
Android shows the alert, IOS doesn't.
If I await the DisplayAlert, execution doesn't return back to the method.
A possible related issue is if I use Navigation.PopAsync(); in the main method I get (only in IOS):
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
I would appreciate a response as I am trying to execute some code when paging, if it fails I want to display an alert then return back to the previous page.
I have attached my example.
Created attachment 23131 [details]
Hi Dave, you can use Device.BeginInvokeOnMainThread() to ensure that DisplayAlert() is called on the main thread. This appears to resolve the issue when testing with the attached project:
DisplayAlert("Test", "Test Alert", "Okay");
Hope this helps!