Forum Xamarin.Forms

Xamarin.Forms PopAsync MasterDetail

LaurenceMommersLaurenceMommers BEMember
edited September 2017 in Xamarin.Forms

Hello,

i created an app with a login flow according to this example https://developer.xamarin.com/samples/xamarin-forms/Navigation/LoginFlow/
but instead of a normal MainPage i am using a MasterDetail.

Now when i just open the app, use it, and then push the back button on the master detail it's fine and the app closes.
But, when i "log out" a page gets inserted before the MasterDetail and the MasterDetail view gets popped from the navigation stack.
If i then push the back button on the new page the app closes and crashes with an error saying:

Unhandled Exception:

System.ArgumentException: Handle must be valid.
Parameter name: instance

if i follow the stack trace and compare it to the github source code i end up in https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs on line 155:
_drawerLayout.RemoveDrawerListener(_drawerListener);

It looks like xamarin is still trying to cleanup my master detail while this is already removed by popping it from the navigation stack.

Am i correct and is this a bug in Xamarin.Forms? If so, is there a workaround?

Kind regards,
Laurence Mommers

Sign In or Register to comment.