PopToRootAsync ( or PushAsync) is not supported globally on Android, please use a NavigationPage

ShamnadShamnad USMember ✭✭✭
edited March 2016 in Xamarin.Forms

Steps to replicate Exception.

  1. Exception 1 : System.InvalidOperationException: PopToRootAsync is not supported globally on Android, please use a NavigationPage.
  • Presents a page (PushModalAsync) modally from HomePage.
  • Click a button to navigate to root (PopToRootAsync)
    ---- results in Exception : System.InvalidOperationException: PopToRootAsync is not supported globally on Android, please use a NavigationPage.
  1. Exception : System.InvalidOperationException: PushAsync is not supported globally on Android, please use a NavigationPage.
  • Presents a page (PushModalAsync) modally from HomePage.
  • BackButton press evevnt is overridden to push a page.
    ---- results in Exception : System.InvalidOperationException: PushAsync is not supported globally on Android, please use a NavigationPage.

Details :

Microsoft Visual Studio Enterprise 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081

Installed Version: Enterprise

Architecture and Modeling Tools 00322-80000-00000-AA852
Microsoft Architecture and Modeling Tools

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015 00322-80000-00000-AA852
Microsoft Visual Basic 2015

Visual C# 2015 00322-80000-00000-AA852
Microsoft Visual C# 2015

Xamarin 4.0.1.96
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android 6.0.1.10
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS 9.4.1.24
Visual Studio extension to enable development for Xamarin.iOS.



Attachment : Sample with replicated exception.
Bugzilla : Bug 39292

Answers

  • YkshLeoYkshLeo USMember ✭✭✭✭
    edited March 2016

    Workaround for Exception : System.InvalidOperationException: PopToRootAsync is not supported globally on Android, please use a NavigationPage.


    Instead of using :

    Navigation.PopToRooTAsync();
    

    Use :

    App.Instance.MainPage = new NavigationPage(new HomePage());
    

    This is not a perfect solution, so this bug is needed to be fixed soon.

  • SheemuSheemu USMember ✭✭

    Thanks @YkshLeo work for me.

Sign In or Register to comment.