Bug 27798 - Android, Page OnDisappearing for first page fires after OnAppearing for target page
Summary: Android, Page OnDisappearing for first page fires after OnAppearing for targe...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.4
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
Depends on:
Reported: 2015-03-09 17:19 UTC by Kraig Brockschmidt
Modified: 2017-08-29 03:50 UTC (History)
12 users (show)

Tags: android functionality contentpage consistency AC
Is this bug a regression?: ---
Last known good build:

Repro sample (260.66 KB, application/x-zip-compressed)
2015-03-09 17:19 UTC, Kraig Brockschmidt
Sample-Updated (545.90 KB, application/x-zip-compressed)
2016-08-23 21:58 UTC, Cody Beyer (MSFT)

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 27798 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 Kraig Brockschmidt 2015-03-09 17:19:03 UTC
Created attachment 10231 [details]
Repro sample

I'm seeing inconsistencies with the Page.OnAppearing and OnDisappearing events on Android vs. iOS and WP. In our app I have the home page and a configuration page, and I've attempted to use Configuration.OnDisappearing to check if changes have been made and then apply them, so that the Home.OnAppearing cam check for changes and refresh itself.

However, I'm seeing that Home.OnAppearing is firing before Configuration.OnDisappearing on Android, but not on iOS or WP. I've looked at https://bugzilla.xamarin.com/show_bug.cgi?id=26479 which perhaps seems related, but don't see a known bug specifically on inconsistent ordering of these events. 

In the attached sample, here's the Windows Phone and iOS 8.1 output navigating from Page1 to Page2, hitting the back button:

Page1.OnAppearing (startup event)

This is exactly what's expected. On Android, however, I get the following output:

Page1.OnAppearing (startup event)

This makes it impossible to use these events to determine whether to take action in the newly appearing page. In my particular case, it forces the app to inefficiently persist changes every time they're made in the UI, rather than just once when the page disappears.
Comment 1 Atin 2015-03-11 14:37:18 UTC
I have checked this issue and able to reproduce the reported behavior with the help of given sample given in the bug description.I checked this issue with Xamarin.Forms

Screencast: http://www.screencast.com/t/AGma21lcI
Application Output(Android):
Application Output(iOS): https://gist.github.com/Rajneesh360Logica/f085d1f96c3f16c2ab73
Ide Logs: https://gist.github.com/Rajneesh360Logica/38e242b693e1c95da40e

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641

Xamarin   3.9.357.0 (177f860)

Build Host
Comment 2 Jason Smith [MSFT] 2016-04-08 18:48:40 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team
Comment 3 Cody Beyer (MSFT) 2016-08-23 21:57:59 UTC
Platform disparity occurs in latest version. Sample attached
Comment 4 Cody Beyer (MSFT) 2016-08-23 21:58:23 UTC
Created attachment 17187 [details]
Comment 5 Mike Norman 2017-06-16 17:16:37 UTC
It just repro'd again.