Bug 53351 - (XF/iOS) PageRenderer of ContentPage is in a TabbedPage's Disappear() method is not called when I change App.MainPage.
Summary: (XF/iOS) PageRenderer of ContentPage is in a TabbedPage's Disappear() method ...
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2017-03-15 12:20 UTC by Bright Lee
Modified: 2017-03-21 18:25 UTC (History)
4 users (show)

Tags: AC
Is this bug a regression?: Yes
Last known good build: 2.3.3

sample project (31.16 KB, application/zip)
2017-03-15 12:20 UTC, Bright Lee
breakpointbeinghit (250.08 KB, image/png)
2017-03-15 15:51 UTC, Rui Marinho
correct sample project (31.35 KB, application/zip)
2017-03-15 17:13 UTC, Bright Lee

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 Bright Lee 2017-03-15 12:20:51 UTC
Created attachment 20347 [details]
sample project

PageRenderer's Disappear() is not called when ContentPage is in a TabbedPage.
It is not called when I change App.MainPage on forms.

This causes many problems because we do unregister observers in ViewWillDisappear.
If this renderer method's not called, there is no way to unregister observer.

attached sample project reproduces it.

tested XF ver : 2.3.4-pre5

It worked fine on
Comment 1 Rui Marinho 2017-03-15 15:36:29 UTC
This works fine for me with your repo. 

Can you give me what versions of Xamarin you have? 

Comment 2 Rui Marinho 2017-03-15 15:51:56 UTC
Created attachment 20357 [details]
Comment 3 Bright Lee 2017-03-15 17:13:28 UTC
Created attachment 20363 [details]
correct sample project

I'm sorry to attach wrong sample project. 

The contentpage should be inside Navigation.

To reproduce..
1. select second tab named "nav"
2. press the button.

Both ViewWillDisappear and ViewDidDisappear are not called
Comment 4 Bright Lee 2017-03-15 17:13:58 UTC
I attached new sample project again. 
Please look this.

Comment 5 Bright Lee 2017-03-15 17:17:32 UTC
Comment on attachment 20347 [details]
sample project

This prev project does not reproduce the issue.

Please try my new attachment project.
Comment 6 Rui Marinho 2017-03-17 12:55:35 UTC
Hey Bright Lee, can you try override dispose and see if it works for you on the custom renderer ? 

The thing is to fix a memory leak we are disposing the custom renderer first and that's why you don't get the override being called. We do RemoveFromSuperView first, but it seems it doesn't call ViewDidDisappear .
Comment 7 Bright Lee 2017-03-17 13:05:29 UTC
If you ask me if I can or not, I'll say yes and no problem. 
I checked it and works fine.

But I can not say anything if it's right.
At least I'm afraid this changes will be a problem on other companies' app as well.

Especially if they've been unregistering an observer in OnDisappear().
Comment 8 Samantha Houts [MSFT] 2017-03-21 18:25:56 UTC
@Bright Lee: Thank you for your feedback. We agree that this is a behavioral change that may affect other users. We will include a warning note on the 2.3.4 release notes.