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 (show other bugs)
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)

See Also:
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]

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.

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