question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PopAsync clear all pages on Navigation Stack (1.1.0-pre2)

See original GitHub issue

If i pop a normal page after pop a popup page like that:

await PopupNavigation.Instance.PopAsync();
await Navigation.PopAsync();

An exception raise at Navigation.PopAsync because after i pop the popup page, the Navigation Stack is empty. But if i exchange order of method like that:

await Navigation.PopAsync();
await PopupNavigation.Instance.PopAsync();

The app works normaly. I’m using Xamarin.Forms 2.4.0.282.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rotorgamescommented, Feb 5, 2018

@Lincolnerson These issues are only about Pg.Plugins.Popup, not about Xamarin.Forms. You can create an issue here (https://github.com/xamarin/Xamarin.Forms/issues) or here (https://bugzilla.xamarin.com/)

0reactions
Lincolnersoncommented, Feb 5, 2018

Hi, I am going from Page 1 > Page 2 > Page 3 Once process is completed I am using following code to return on Page 2: Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 1])

Then again from Page 2 moving to Page3, but this time same above code is throwing below exception: UNHANDLED EXCEPTION: 02-05 17:00:39.083 I/MonoDroid( 1102): System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. 02-05 17:00:39.083 I/MonoDroid( 1102): Parameter name: index 02-05 17:00:39.083 I/MonoDroid( 1102): at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 02-05 17:00:39.083 I/MonoDroid( 1102): at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 02-05 17:00:39.083 I/MonoDroid( 1102): at System.Collections.Generic.List1[T].get_Item (System.Int32 index) [0x00009] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 02-05 17:00:39.083 I/MonoDroid( 1102): at CTS_CPR.View.Test.AcceleroMeterFinal.OnButtonPressed () [0x0002a] in D:\WorkSpace\Mobile\CPR\CTS-CPR\CTS-CPR\CTS_CPR\View\Test\AcceleroMeterFinal.xaml.cs:192 `

I also tried ‘Navigation.PopAsync()’ but still getting same issue. My main concern is this both code remove all pages from stack during second time when i come from Page 2 to Page3

Read more comments on GitHub >

github_iconTop Results From Across the Web

NavigationStack is cleared after Popasync
I have a weird behavior on Xamarin.Forms on iOS. Before popping, I have 3 pages in my navigation stack. After popping, the navigation...
Read more >
NavigationPage.PopAsync Method (Microsoft.Maui.Controls)
Asynchronously removes the top Page from the navigation stack, with optional animation.
Read more >
Removing items from Xamarin.Forms navigation back stack
My first instinct was to just remove an element from the back after navigating to the next page, but in Xamarin.Forms the back...
Read more >
Xamarin Forms Navigation: The Current State
In Forms, the method PopToRootAsync will remove all pages except for the first page in the Navigation stack. Remember, if you are within...
Read more >
Navigation Basics
Forms navigation relies on a Page class instance to navigate, Prism removes all dependencies on Page types to achieve loosely coupled navigation from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found