Bug 35132 - Pages are not collected when using a Navigationpage
Summary: Pages are not collected when using a Navigationpage
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-10-21 08:42 UTC by John Miller [MSFT]
Modified: 2017-03-24 22:51 UTC (History)
5 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Sample Project (67.00 KB, application/zip)
2015-10-21 08:42 UTC, John Miller [MSFT]
Correct repro project (55.93 KB, application/x-zip-compressed)
2017-03-24 22:51 UTC, E.Z. Hart [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 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 John Miller [MSFT] 2015-10-21 08:42:15 UTC
Created attachment 13477 [details]
Sample Project


   Not all children pages pushed in a NavigationPage are collected once navigated away from. 

**Steps to Reproduce:**

   1. Run the attached sample on an Android simulator.
   2. Press the Open button to navigate to page 2. 
   3. Note the count at the top of the screen. 
   4. Press the back button to go back to page 1. 
   5. Repeat steps 2-4. 

**Actual Results:**

   The count being used to track page instances increases to 5 before a page is finalized. Then, it stays at 4 with repeated tests. 

**Expected Results:**

   The count should not increase past 1. 

**Build Date & Platform:**

   XF 1.5.1
Comment 2 E.Z. Hart [MSFT] 2017-03-24 22:51:36 UTC
Created attachment 20839 [details]
Correct repro project

The original repro project has a bug where the decrement of _liveCount doesn't get called in the finalizer (to see this, run it against the latest stable version of XF and notice that the Debug.WriteLine call in the finalizer writes to the debug console, but the value of the counter doesn't actually decrement).

I'm uploading a corrected repro project which uses the latest stable ( and demonstrates that the counter never goes above 2 (one for the currently displayed page and one for the last page popped off of the navigation stack), which is the expected behavior.