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.
Created attachment 11805 [details]
Page1 pushes Page2 using Navigation.PushModalAsync (from Page1). Page2 then calls Navigation.PopModalAsync (from within Page2). That pop is using Page2's Navigation property, which should have its own modal stack. I believe this should throw, but instead it pops Page2. Next, Page2 pushes Page2 using Navigation.PushModalAsync (still from within Page2, using Page2's Navigation property). This page is never shown.
This behavior is inconsistent. There are two possibly consistent results:
1. Page2's call to PopModalAsync should throw.
2. Page3 should be shown.
The way it works now tries to sometimes pretend that there's only one stack, but other times acts as if each page has its own independent stack. I prefer option 1 because it forces people to understand the nested hierarchical nature of navigation, and it matches the behavior of iOS's native API, where each view controller can present one and only one thing at a time, and you can only dismiss it from the view controller that presented it.
To test this run the attached app (from this discussion: https://forums.xamarin.com/discussion/44635/why-does-popmodalasync-error-in-ios-but-work-on-android), press the button on the first page, and then the first button on the second page.
Modal stack is global, not per page.
There's still a bug, though. If the modal stack is global then the correct behavior is option two listed above: Page3 should have been shown. Instead, Page3 was not shown because it was pushed from Page2's Navigation object while Page2 was not on screen. If the stack is global then why does it matter whether the Page you're pushing it from is on the stack or not?
This API is broken, and it's confusing people who try to use it.
Migrated to https://github.com/xamarin/Xamarin.Forms/issues/1427
Please subscribe to that issue for future updates.