Bug 56807 - OnAppearing sometimes does not fire when navigating to a page after a particular sequence
Summary: OnAppearing sometimes does not fire when navigating to a page after a particu...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Paul DiPietro [MSFT]
Depends on:
Reported: 2017-05-24 15:19 UTC by YLNK
Modified: 2018-05-09 14:45 UTC (History)
6 users (show)

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 for Bug 56807 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description YLNK 2017-05-24 15:19:05 UTC
Note: I have not yet been able to test this on iOS, only Android so far. 

I have a TabbedPage with 3 Navigation pages inside of it. If I navigate around the tabs, each page will hit its OnAppearing function each time the tab is changed. SOMETIMES, after the app is first launched, the first time navigating to one of the tabs, it will not hit OnAppearing, thereafter it will work every time.

Otherwise, the sequence of events wherein my page will not hit OnAppearing about half the time is when I am on the center tab, open a modal, perform some operations, open another modal, press back (to previous modal), back again (to center tab), then swipe to the left tab. In this scenario I will hit OnAppearing about 50% of the time, but it seems unpredictable and will sometimes work several times in a row, other times it will not work several times in a row. I use OnAppearing to populate a list with new data when navigating to that page, so sometimes I am not able to update the list as I do not know when they navigated to that page.
Comment 1 YLNK 2017-05-24 15:21:39 UTC
I am using VS 2017, Xamarin version:, Xamarin Android SDK:, Android 7.0
Comment 2 Paul DiPietro [MSFT] 2017-05-30 12:55:19 UTC
Could you upload a reproduction with steps to illustrate the issue?
Comment 3 YLNK 2017-06-01 15:56:49 UTC
I was using Xamarin.Forms, I have upgraded to the latest version and will try to reproduce before posting an example
Comment 4 YLNK 2017-06-01 16:19:09 UTC
Note: This is tested with Xamarin.Forms Nuget package

Alright. Here's a basic gist:

Step 1) App launches, runs "SetMainPage();" - TabbedPage with 3 NavigationPages in it

Step 2) The center page (SetupPage) has a button. The button handler is `someButton_Click'. As you can see this opens a modal of the page "TrainPage"

Step 3) On the TrainPage modal, there is another button that will open a modal of the page StatsDayPage (There are now 2 modals open)

Step 4) Press back (this navigates you to TrainPage)

Step 5) Press back again (this navigates you to SetupPage)

Step 6) Swipe right (so you navigate to the leftmost page, which is "StatsPage" - As you can see this page echos 'System.Diagnostics.Debug.WriteLine("StatsPage OnAppearing entered. . .");' inside the handler for OnAppearing

After this sequence, and sometimes even without doing this sequence, you will not enter OnAppearing when you navigate to StatsPage.

Let me know if additional information is helpful
Comment 5 YLNK 2017-08-29 15:00:57 UTC
This is still a major issue on Xamarin with Nuget Xamarin.Forms, Xamarin.Android.SDK

Only appears to be an issue on Android right now. Able to reproduce this on every run of my app.

Our application loads a splash page (single NavigationPage), when a bluetooth device becomes available, it is connected to automatically, then SetMainPage is called (which can be seen in my previous comment on the Github gist), the 3 pages loaded will all have their OnAppearing hit irrespective of which page the app starts on, then on first navigation to any of the pages that are not displayed, OnAppearing will not be hit on first navigation.

This is reproducible 100% of the time