Bug 60413 - Blank page on resume app
Summary: Blank page on resume app
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: PC Windows
: Normal blocker
Target Milestone: ---
Assignee: Samantha Houts [MSFT]
Depends on:
Reported: 2017-10-27 13:48 UTC by ComCon
Modified: 2017-12-06 15:06 UTC (History)
4 users (show)

Tags: resume, blank, ac
Is this bug a regression?: Yes
Last known good build:

Small app to show bug (56.36 KB, application/x-zip-compressed)
2017-10-27 13:48 UTC, ComCon

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:

Description ComCon 2017-10-27 13:48:35 UTC
Created attachment 25484 [details]
Small app to show bug

I get always blank page when i try to resume my app(after minimizing). This behaviour occurs only after an update of forms to 2.4.

Steps to reproduce:
- Update app to latest 2.4
- Run app
- Minimize app
- Run app again(resume)
- Admire blank page

Attached app with 2.3.X.
Comment 1 Paul DiPietro [MSFT] 2017-10-27 15:38:45 UTC
The project doesn't appear to reproduce the issue on an API 21 emulator or an S8 device. Can you provide more info about the device or emulator you're using or if there's some other step missing?
Comment 2 ComCon 2017-10-27 19:59:00 UTC
Attached project works fine. I let it on FF2.3.X to show how it should work. You have to upgrade this project to FF2.4.280(for example) and then it should not more work
Comment 3 Paul DiPietro [MSFT] 2017-10-27 20:12:21 UTC
Okay, for some reason before it wasn't doing it; maybe caching issues.
Comment 4 Samantha Houts [MSFT] 2017-11-11 00:42:26 UTC
I cannot reproduce this with version Please update and let us know if it is still a problem. Thanks!
Comment 5 ComCon 2017-11-13 10:22:57 UTC
No. The problem is not solved. Try following steps to reproduce:
- Download my app atached
- Compile and deploy(this version will work)
- uninstall app on test device
- uninstall forms in solution via nuget manager
- install newest 2.4.X
- Compile and deploy
Comment 6 ComCon 2017-11-20 08:49:24 UTC
When will it be fixed? I need an estimation for my chief.
Comment 7 Samantha Houts [MSFT] 2017-11-20 21:24:14 UTC
I suspect that this was working before by virtue of a memory leak that kept the page fragments alive even though the pages were disposed by Android on minimize. 

I recommend that you use something more like this:

if (!SimpleIoc.Default.IsRegistered<GalaSoft.MvvmLight.Views.INavigationService>())
	nav = new NavigationService();
	nav.Configure(ViewModelLocator.LoginPage, typeof(Views.LoginPage));
	SimpleIoc.Default.Register<GalaSoft.MvvmLight.Views.INavigationService>(() => nav);
	nav = (NavigationService)SimpleIoc.Default.GetInstance<GalaSoft.MvvmLight.Views.INavigationService>();

var navPage = new NavigationPage(new Views.LoginPage());
MainPage = navPage;

This will ensure that you are providing your MainPage and NavService with a live set of fragments.

Let me know if you have any further issues! Thanks!
Comment 8 ComCon 2017-11-30 11:52:41 UTC
In my example app there is only one view to simplify my issue. In my prod app there are a lot of views. The line:
"av = (NavigationService)SimpleIoc.Default.GetInstance<GalaSoft.MvvmLight.Views.INavigationService>();" makes possible that i navigate back to last used view. In your solution this else-part makes no sense. Your proposal/solution is also always to navigate to login-view? Sorry but that is a bad joke.
Comment 9 Samantha Houts [MSFT] 2017-12-01 00:44:12 UTC
My proposal was simplified to reflect the reproduction.

You can keep track of what view you want to navigate back to, but you must recreate the view. You can't reuse the same dead renderer.