Bug 26616 - iOS 1.3.2: NavigationPage.RemovePage not working correctly
Summary: iOS 1.3.2: NavigationPage.RemovePage not working correctly
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.2
Hardware: PC Windows
: Normal normal
Target Milestone: 1.3.4
Assignee: Bugzilla
Depends on:
Reported: 2015-01-31 14:40 UTC by jruskin
Modified: 2015-06-01 04:48 UTC (History)
10 users (show)

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

repro project (4.78 MB, application/octet-stream)
2015-01-31 14:40 UTC, jruskin

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 jruskin 2015-01-31 14:40:00 UTC
Created attachment 9585 [details]
repro project

After calling Page.Navigation.RemovePage I'm seeing that pressing the navbar back button is then navigating to the page that used to be on the stack but was removed.  The page itself is entirely empty though the navbar back title continues to display.  Continuing to press back will not end up navigating to any pages that are still on the stack, it seems like the navigation stack is completely broken at this point.

Note that the same shared code works great when running the Android project.
Comment 1 jruskin 2015-01-31 14:51:58 UTC
Interesting... looks like adding a small await Task.Delay between calls to RemovePage fixes the problem.  Even down to await Task.Delay(1).
Comment 2 Ram Chandra 2015-02-02 09:39:57 UTC
I have checked this issue and with the help of attached sample I am able to reproduce this issue.

Observation: When I click on the navigation bar, I observed that page is navigated to previous page and the content of page is blank. When I adding a small await Task.Delay(1) it works and navigated to page 1 and shows the content of page.

I have checked the same on android project and observed that the same is working fine on android, without adding the Task.Delay(1) .

Screencast: http://www.screencast.com/t/6HtDiFzM8S

IDE logs:  https://gist.github.com/RamChBachkheti/e0655bda5cb0f33cb082

Please let me know if I can provide more info to this issue.

Environment Info:


Windows Info:
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641
Installed Version: Professional
Xamarin (9f3e552)
Xamarin.Android (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS (3b3ef438017c7ecf486defa9e01567a5f2b3cb2a)
Xamarin.iOS Unified Migration   1.0

OSX info:

Mac OS X 10.10.0
Xamarin Studio: 5.8 (build 624)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312000068
Xamarin.Android : (Business Edition)
Xcode 6.1 (6604)
Xamarin.iOS: (Business Edition)
=== Build Information ===
Release ID: 508000624
Git revision: fbedf37530cbbf01a75c4cc95557944aa8996aaa
Build date: 2015-01-30 07:52:28-05
Xamarin addins: cb32b8c2c23d061713c5abe206b8ad07723aa77e
Comment 3 Eric Maupin 2015-02-05 15:44:55 UTC
Should be fixed in 1.3.4-pre1
Comment 5 tim.ahrentlov 2015-02-16 11:47:59 UTC
I also get an error on Android.
Comment 6 tim.ahrentlov 2015-02-17 03:33:30 UTC
I'm getting this with 1.3.4 - pre4 on Android. IOS works fine:

System.Diagnostics.Debugger.Mono_UnhandledException_internal () in 
System.Diagnostics.Debugger.Mono_UnhandledException (ex={System.ArgumentException: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x00010] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:886
at Android.Views.View.set_Visibility (Android.Views.ViewStates) [0x00070] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.View.cs:9908
at Xamarin.Forms.Platform.Android.NavigationRenderer/<>c__DisplayClass8.<SwitchContentAsync>b__5 (Android.Animation.Animator) <IL 0x0000f, 0x00046>
at Xamarin.Forms.Platform.Android.GenericAnimatorListener.OnAnimationEnd (Android.Animation.Animator) <IL 0x0000f, 0x00063>
at Android.Animation.AnimatorListenerAdapter.n_OnAnimationEnd_Landroid_animation_Animator_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Animation.AnimatorListenerAdapter.cs:96
at (wrapper dynamic-method) object.61a1a728-e2ac-4358-8ba3-1cd480465ccf (intptr,intptr,intptr) <IL 0x00017, 0x0001f>
}) in 
object.61a1a728-e2ac-4358-8ba3-1cd480465ccf (arg0=0xffffffffb8845798, arg1=0xffffffff99c00019, arg2=0xffffffffb620001d) in 
Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (jobject=0x0, jclass=0x1d2004ce, jmethod=0xffffffff9de444d0, parms={Android.Runtime.JValue[1]}) in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:886
Android.Views.View.set_Visibility (value=Android.Views.ViewStates.Gone) in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.View.cs:9908
Xamarin.Forms.Platform.Android.NavigationRenderer. (a={ValueAnimator@5369ed3c
    :  0.0  1.0  }) in 
Xamarin.Forms.Platform.Android.GenericAnimatorListener.OnAnimationEnd (animation={ValueAnimator@5369ed3c
    :  0.0  1.0  }) in 
Android.Animation.AnimatorListenerAdapter.n_OnAnimationEnd_Landroid_animation_Animator_ (jnienv=0xffffffffb8845798, native__this=0xffffffff99c00019, native_animation=0xffffffffb620001d) in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Animation.AnimatorListenerAdapter.cs:96
object.61a1a728-e2ac-4358-8ba3-1cd480465ccf (arg0=0xffffffffb8845798, arg1=0xffffffff99c00019, arg2=0xffffffffb620001d) in
Comment 7 tim.ahrentlov 2015-02-17 11:38:12 UTC
I found that removing the call to RemovePage from OnAppearing, made the bug
disappear on Android.
Comment 8 Jason Smith [MSFT] 2015-05-29 21:23:36 UTC
The other issue in this report is not the same as the original bug and was imporperly re-opened. That said I can no longer reproduce the issue on Android (though it might be device/timing specific). Please open a new issue if you still have issues.
Comment 9 Parmendra Kumar 2015-06-01 04:48:03 UTC
As per comment #8, closing this issue