Bug 34572 - Nested modal pages not restored on iOS
Summary: Nested modal pages not restored on iOS
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-05 15:47 UTC by Charles Petzold
Modified: 2016-04-13 18:03 UTC (History)
2 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED ANSWERED

Description Charles Petzold 2015-10-05 15:47:00 UTC
Programs sometimes need to save the state of the navigation stack when the program is suspended and terminated, and restore the stack when the program starts up again. However, there is a problem restoring multiple nested modal pages on iOS.

A general-purpose solution to the problem of saving and restoring the navigation stack is this Application derivative:

https://github.com/xamarin/xamarin-forms-book-preview-2/blob/master/Libraries/Xamarin.FormsBook.Toolkit/Xamarin.FormsBook.Toolkit/MultiPageRestorableApp.cs

That class is demonstrated by this program:

https://github.com/xamarin/xamarin-forms-book-preview-2/tree/master/Chapter24/StackRestoreDemo

This program allows navigating to an arbitrary number of modeless or modal pages, clicking a Stepper on each page for some data to identify the page, and then terminating the program.

To see the iOS problem, first remove a hack from MultiPageRestoreableApp that "fixes" the problem:

https://github.com/xamarin/xamarin-forms-book-preview-2/blob/master/Libraries/Xamarin.FormsBook.Toolkit/Xamarin.FormsBook.Toolkit/MultiPageRestorableApp.cs#L72-L74

This hack inserts a Task.Delay(100) call after each call to PushModalAsync.

Now run the program under iOS. Navigate to at least two modal pages. Use the Stepper to identify each page. Terminate the program from the phone or phone emulator so the state is saved. Run the program again. The page stack is not properly restored.
Comment 1 Jason Smith [MSFT] 2016-04-13 18:03:56 UTC
Hey Charles :)

Thank you for taking the time to submit this feature request. We like this idea and have added it to our internal feature tracking system.

Warm regards,
Xamarin Forms Team