Bug 50623 - OnAppearing does not fire on the ContentPage instance, pushed on the NavigationStack, when the App resumes from background
Summary: OnAppearing does not fire on the ContentPage instance, pushed on the Navigati...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-12-21 21:51 UTC by Zafar
Modified: 2017-02-14 22:38 UTC (History)
4 users (show)

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

Xamarin Forms Project (56.33 KB, application/zip)
2016-12-21 22:03 UTC, Zafar

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 Zafar 2016-12-21 21:51:50 UTC
Steps to reproduce:
1) Create Xamarin.Forms project, essentially targeting Android
2) Create two ContentPage types say P1,P2
2) Set an instance of P1 as the Navigation MainPage in the App
3) Push an instance of P2 on the NavigationStack, on Button click event on P1
4) Send the App to background after navigating to P2
5) Bring the App to foreground and pop out from P2 -> P1

1) When the App is brought to foreground, OnAppearing() fires on both P1 and P2 instances.
OnAppearing() should only be fired on P2 instance as P1 is not currently showing i.e. not on top of NavigationStack

2) After the App is brought to foreground and P2 is popped out to Navigate to P1, OnAppearing() does not fire on P1.
OnAppearing() should be fired when P2 is popped out to navigate to P1
Note: OnAppearing() on P1 gets fired as expected when the App is not sent to background and user pops out from P2 -> P1

Issues occurs on both stable and
Comment 1 Zafar 2016-12-21 22:03:57 UTC
Created attachment 18967 [details]
Xamarin Forms Project
Comment 2 adrianknight89 2016-12-22 18:09:12 UTC
Your repro is not using the latest release. It's using Just to make sure, did you try the latest version?
Comment 3 Zafar 2016-12-22 19:26:34 UTC
Yes, the attached repo is using the old version. I also tried with the latest pre release i.e., it did not work. The reason I reverted the nuget package to the old version is that the latest pre release is not available for download from nuget.org source, because it seems like it is deprecated and not showing up in the available version list. However, I downloaded the package from the website and side loaded it into the project to check if it works.
Comment 4 adrianknight89 2016-12-23 01:36:24 UTC
I tested your repro on top of latest master and wasn't able to reproduce it. I suspect that a near future release should not have this problem.

Note that the problem exists in We should test this again in 2.3.4-pre2.
Comment 5 E.Z. Hart [MSFT] 2017-02-14 22:38:52 UTC
This is working as expected on the latest nightly build, so this should be fixed in 2.3.5.