Bug 54308 - Navigation.RemovePage Causes Next Navigation Operation to Fail
Summary: Navigation.RemovePage Causes Next Navigation Operation to Fail
Status: RESOLVED DUPLICATE of bug 53179
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-03-30 21:56 UTC by tchadwick
Modified: 2017-03-31 18:46 UTC (History)
2 users (show)

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

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:
Status:
RESOLVED DUPLICATE of bug 53179

Description tchadwick 2017-03-30 21:56:50 UTC
Using Navigation.RemovePage to remove previous page in navigation stack causes the following calls to Navigation.Push or Pop to fail and throw an exception.
Steps to reproduce:
1. Create a Xamarin.Forms (PCL) project with three pages wrapped by a Navigation Page for the Main Page.
2. Have a button on each page that loads the next page.  (e.g. 1->2->3)
3. Have page 2's button push page 3 then remove itself from the navigation stack.
4. Run on the Android Emulator

Expected:
Remove itself from the navigation stack so when Navigation.PopAsync is called by page 3, it navigates to page 1.  (this is currently the case for iOS, and UWP)

Actual:
App crashes with the following debug information:

An unhandled exception occured.

InspectorDebugSession(8): HandleTargetEvent: UnhandledException
03-30 15:40:33.619 E/AndroidRuntime( 3895): FATAL EXCEPTION: main
03-30 15:40:33.619 E/AndroidRuntime( 3895): Process: efcMobileApp.Droid, PID: 3895
03-30 15:40:33.619 E/AndroidRuntime( 3895): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4590)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.view.ViewGroup.removeViewAt(ViewGroup.java:4552)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1540)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:757)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2355)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.os.Handler.handleCallback(Handler.java:739)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.os.Handler.dispatchMessage(Handler.java:95)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.os.Looper.loop(Looper.java:148)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at android.app.ActivityThread.main(ActivityThread.java:5417)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at java.lang.reflect.Method.invoke(Native Method)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
03-30 15:40:33.619 E/AndroidRuntime( 3895): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Environment: 

Microsoft Visual Studio Professional 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586


Visual Studio Tools for Universal Windows Apps   14.0.25527.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.3.0.789 (4d2ed3d)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.1.0.43 (3a62f1e)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.4.0.128 (ba11e48)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Paul DiPietro [MSFT] 2017-03-31 18:46:20 UTC

*** This bug has been marked as a duplicate of bug 53179 ***