Xamarin.forms: Regression - Android - Exception thrown during NavigationPage.Navigation.PopAsync

Created on 26 May 2018  路  5Comments  路  Source: xamarin/Xamarin.Forms

I am seeing an ArgumentOutOfRangeException when executing PopAsync after inserting a page into the navigation stack, which seems to be a regression of this issue and may be related to #2576 .

The issue can be reproduced by adding a single empty page to an empty template project and then including the following code in an async OnStart() implementation:

    var nav = (NavigationPage) MainPage;
    nav.Navigation.InsertPageBefore(new SecondPage(), nav.CurrentPage);
    await nav.Navigation.PopAsync(false);

This issue only affects Android projects using Material Design (FormsAppCompatActivity).

  • Version with issue: All Xamarin.Forms versions from v2.5.1.444934 onwards
  • Last known good version: v2.5.0.280555
  • IDE: VS2017 v15.7.1
  • Android Target Framework: 7.1, 8.0, 8.1
  • Android Support Library Version: v25.4.0.2 and v27.0.2

StackTrace.txt
BugRepro.zip

regression Android bug

Most helpful comment

This is happening for me as of 3.4.0.1008975

EDIT: Actually, it looks like it's a result of auto-navigating away from the page during an "Appearing" event, even though the stack indicates having pages available during pop.

The entire Navigation management system seems to be quite unstable.

All 5 comments

I seriously believe that this situation is not acceptable...new and old bugs appear with each new release.
When the fix will be released?

I hope this time unit tests are implemented, so that any further regression gets caught by CI

Hi @opcodewriter that's for your feedback it's hard to unit test platform code, the interation, time on device etc make it super hard. We do write UI Test, and i wrote one in my fix, that's how i found out this seems to be a issue also in iOS :)

This is happening for me as of 3.4.0.1008975

EDIT: Actually, it looks like it's a result of auto-navigating away from the page during an "Appearing" event, even though the stack indicates having pages available during pop.

The entire Navigation management system seems to be quite unstable.

@jefffhaynes
Did you find a workaround to this issue or open another issue? I'm having the same issue - unable to pop after autonavigating in onAppearing

Was this page helpful?
0 / 5 - 0 ratings