|Summary:||OnAppearing/Disappearing triggers for all pages in navigationstack backgrounding/foregrounding app|
|Severity:||normal||CC:||adrianknight89, bjorn.bentmar, david, davrdavr, ionixjunior, jason.smith, kaushal.panjwani, kent.boogaart, rui.marinho, samantha.houts, thomas, tobbe.l.malm, v-amdha|
|Tags:||Is this bug a regression?:||---|
|Last known good build:|
Test case to trigger error
Attached IDE logs
Description Jens-Christian 2017-02-06 14:18:49 UTC
This is almost the same as https://bugzilla.xamarin.com/show_bug.cgi?id=41322, except that I'm using MasterDetailPage, not NavigationPage as my MainPage. When using MasterDetailPage, the error is still present. I'm testing using Xamarin.Forms 184.108.40.206-pre2.
Comment 1 Björn Bentmar 2017-02-06 14:36:55 UTC
Can you describe the case a bit more?
Comment 2 Jens-Christian 2017-02-07 07:00:40 UTC
Created attachment 19745 [details] Test case to trigger error I have modified the example from https://bugzilla.xamarin.com/show_bug.cgi?id=41322, to use MasterDetailPage instead, to trigger this error. The error is that when you have several pages in the navigation stack, and navigation out of the application (push home button, open web page with Device.OpenUri, take a photo, etc), all pages in the navigation stack receives OnAppearing, and will not receive OnAppearing when the pages are popped from the navigation stack.
Comment 3 Björn Bentmar 2017-02-07 10:05:51 UTC
sigh.. I just confirmed it, the same behavour still appears from the bug https://bugzilla.xamarin.com/show_bug.cgi?id=41322 when the NavigationPage is the detailpage of a MasterDetailPage.
Comment 4 Björn Bentmar 2017-02-07 10:24:35 UTC
However, this can be worked around. in you App.cs add: this.On<Android>().SendAppearingEventOnResume(false); this.On<Android>().SendDisappearingEventOnPause(false); Now if you want to trigger appearing/disappearing on resume/pause, use the native resume/pause and implement a message for your own appearing/disappearing logic when app resumes or pauses
Comment 5 Jens-Christian 2017-02-07 11:18:48 UTC
Thank you for the workaround, I will look into it if the error isn't fixed when Xamarin.Forms 2.3.4 goes stable.
Comment 6 adrianknight89 2017-02-09 04:54:01 UTC
Comment 7 Ione Souza Junior 2017-03-02 11:41:50 UTC
I found a similar problem, I looking for similar issues before create new ticket and found this. Behaviour in iOS: 1) Open app; 2) Navigate to second page 3) Put the app in background After this, OnDisappearing event on page 2 is not called. 4) Put the app in foreground After this, OnAppearing event on page 2 is not called. Behaviour in Android 1) Open app; 2) Navigate to second page 3) Put the app in background After this, OnDisappearing event on page 2 is called. 4) Put the app in foreground After this, OnAppearing event on page 1 and 2 are called. I attach sample project named NavPageProject for testing. Informations about my environment: === Xamarin Studio Community === Version 6.2 (build 1821) Installation UUID: a6a5f1a6-63ce-4c25-b5f7-1942c9a48cde Runtime: Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit) GTK+ 2.24.23 (Raleigh theme) Package version: 408000495 === NuGet === Version: 220.127.116.11 === Xamarin.Profiler === Version: 1.0.2 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler === Xamarin.Android === Version: 18.104.22.168 (Xamarin Studio Community) Android SDK: /Users/ionixjunior/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 4.4 (API level 19) 6.0 (API level 23) 7.0 (API level 24) 7.1 (API level 25) SDK Tools Version: 25.2.5 SDK Platform Tools Version: 25.0.3 SDK Build Tools Version: 25.0.2 Java SDK: /usr java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL === Xamarin Android Player === Not Installed === Apple Developer Tools === Xcode 8.2.1 (11766.1) Build 8C1002 === Xamarin.Mac === Version: 22.214.171.1243 (Xamarin Studio Community) === Xamarin.iOS === Version: 10.4.0.123 (Xamarin Studio Community) Hash: 35d1ccd Branch: cycle9 Build date: 2017-02-16 17:40:00-0500 === Xamarin Inspector === Version: 126.96.36.199 Hash: cdc01b9 Branch: 1.1-release Build date: Wed, 22 Feb 2017 23:24:11 GMT === Build Information === Release ID: 602001821 Git revision: d41b6e51f3fa46a1943f2e31a778d28a7c73d069 Build date: 2017-02-17 15:18:19-05 Xamarin addins: 1363a8d943bab7700c93a97474060b6734aa7f94 Build lane: monodevelop-lion-cycle9 === Operating System === Mac OS X 10.12.0 Darwin ione.local 16.0.0 Darwin Kernel Version 16.0.0 Mon Aug 29 17:56:20 PDT 2016 root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64
Comment 8 Ione Souza Junior 2017-03-02 11:42:53 UTC
Created attachment 20083 [details] NavPageProject.zip Sample project.
Comment 9 thomas 2017-03-10 07:53:36 UTC
This especially a problem for all users of RxUI as it heavily relies on the WhenActivated pattern which uses the OnAppearing Hook
Comment 10 Diego 2017-03-10 18:02:43 UTC
Tested in Xamarin.Forms 188.8.131.52-pre4, this bug remains. Using MasterDetail
Comment 11 Rui Marinho 2017-03-14 12:05:05 UTC
Should be fixed on 2.3.5-pre1
Comment 12 Diego 2017-03-30 12:46:47 UTC
@Rui, where could we get the version 2.3.5-pre1. So far the latest version in Nuget is 184.108.40.206-pre6.
Comment 13 Aman Dharwal 2017-07-13 06:41:46 UTC
Created attachment 23514 [details] Attached IDE logs This issue doesn't exist anymore, hence marking it as Verified ===================================================================== Verified on Environment : https://gist.github.com/saurabh-paunikar/4932c704b6a205cf61457a008c16f8be package id="Xamarin.Forms" version="220.127.116.116-pre6" ===================================================================== Screencast link : https://www.screencast.com/t/2IvSgxBcEbM
Comment 14 thomas 2017-07-13 11:28:39 UTC
I just tested it and it seems that OnAppearing doesn't get called at all when backgrounding/foregrounding at least when using a TabbedPage as MainPage.
Comment 15 thomas 2017-07-13 12:10:18 UTC
Strange, tested it with another Solution and there it just works fine
Comment 16 thomas 2017-07-13 13:15:23 UTC
While closer looking I found some other odd behaviour. At startup when using a TabbedPage as MainPage you can observe this Call sequence for the active TabbedPage: OnAppearing OnDisapperaing OnApearing You can reproduce it with this App https://github.com/escamoteur/TweetArchive/commit/b629e0ccd5379f007d907d923c5a03b6e046288d You get this Output [0:] ++++++++++++++++++++++++++++++TweetListPage OnAppearing 07-13 15:05:53.010 I/OpenGLRenderer(10466): Initialized EGL, version 1.4 WARNING: linker: /vendor/lib/libhwuibp.so: unused DT entry: type 07-13 15:05:53.020 W/linker (10466): /vendor/lib/libhwuibp.so: unused DT entry: type 0xf arg 0xeb5 0xf arg 0xeb5 Thread started: <Thread Pool> #14 InspectorDebugSession(7): HandleTargetEvent: ThreadStarted 07-13 15:05:53.098 W/Mono (10466): The request to load the assembly System.Core v18.104.22.168 was remapped to v22.214.171.124 07-13 15:05:53.101 W/Mono (10466): The request to load the assembly System.Core v126.96.36.199 was remapped to v188.8.131.52 [0:] ++++++++++++++++++++++++++++++++TweetListPage OnDisappearing [0:] ++++++++++++++++++++++++++++++TweetListPage OnAppearing