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...
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 1.3.4
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-03-09 17:19 UTC by Kraig Brockschmidt
Modified: 2017-08-29 03:50 UTC (History)
12 users (show)

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


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

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)
Page1.OnDisappearing
Page2.OnAppearing
Page2.OnDisappearing
Page1.OnAppearing


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

Page1.OnAppearing (startup event)
Page2.OnAppearing  
Page1.OnDisappearing
Page1.OnAppearing  
Page2.OnDisappearing

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 1.4.1.6342-pre1.

Screencast: http://www.screencast.com/t/AGma21lcI
Application Output(Android):
https://gist.github.com/Rajneesh360Logica/0add0836f65edc24f537
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 3.9.0.349
Xamarin.iOS 8.6.3.3
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]
Sample-Updated
Comment 5 Mike Norman 2017-06-16 17:16:37 UTC
It just repro'd again.

Note You need to log in before you can comment on or make changes to this bug.