For some reason I can not get a certain page in my application to successfully pop from the navigation stack on iOS. I am using the popModalAsync() method without issue in several other areas, but this particular instance always throws a System.ArgumentOutOfRangeException.
`try
{
Device.BeginInvokeOnMainThread(async () =>
{
await curData.currentRootPage.Navigation.PopModalAsync(true);
//await App.Current.MainPage.Navigation.PopModalAsync(true);
//await Navigation.PopModalAsync(true);
});
}`
The commented lines show the other calls I have attempted.
For the record, I am pushing the page via Navigation.PushModalAsync(new PageType()).
Application Specific Information:
*** Terminating app due to uncaught exception 'System.ArgumentOutOfRangeException', reason: 'System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.'
Xamarin Exception Stack:
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/throwhelper.cs:93
at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/throwhelper.cs:56
at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <0f7865fc4fbb4fddaab6f86c915ebae0>:0
at Xamarin.Forms.Internals.NavigationProxy.PopModal () [0x0000b] in \agent_work\1\s\Xamarin.Forms.Core\NavigationProxy.cs:230
at Xamarin.Forms.Internals.NavigationProxy.OnPopModal (System.Boolean animated) [0x00007] in \agent_work\1\s\Xamarin.Forms.Core\NavigationProxy.cs:168
at Xamarin.Forms.Internals.NavigationProxy.PopModalAsync () [0x00000] in \agent_work\1\s\Xamarin.Forms.Core\NavigationProxy.cs:84
at ESPMobile.CameraPage.b__3_0 () [0x00000] in /Users/clarkin/NewDevelopment/ESPMobile/Pages/CameraPage.xaml.cs:48
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/Foundation/NSAction.cs:163
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.9.1.24/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at ESPMobile.iOS.Application.Main (System.String[] args) [0x00000] in /Users/clarkin/NewDevelopment/iOS/Main.cs:13