Why does changing MainPage take 30+ seconds sometimes?

ChrisLarkinChrisLarkin USUniversity ✭✭

I'm trying to figure out why my logout function is taking so long. I haven't test on Android yet, but the iOS portion of my Xamarin Forms project takes 15-30 seconds to log out, when all I am doing is re-assigning the MainPage variable. I do the same thing to add pages to my navigation stack and don't have any problems there. Anyone have any ideas?

Tagged:

Best Answer

Answers

  • NMackayNMackay GBInsider, University mod

    Fair chance it'll be slower in Android and UWP then.

    Your resetting the nav stack when you set a new nav page so there is some attempted tear down of pages already in the stack. Are you executing code when the page is popped or on OnDisappearing?

    It takes 2-4 secs usually in my apps with the Restful call to end the session.

    If the MainPage is always the same you can PopToRootAsync instead.

    It shouldn't be 15-20 secs.

  • ChrisLarkinChrisLarkin USUniversity ✭✭

    I actually had issues using PopToRootAsync earlier on in development, and I noticed a few forum postings here suggesting that manually clearing out the navigation stack was no longer necessary - so I have been literally just re-assigning my root page to the MainPage property once the logout function has been called. I'll give PopToRootAsync another try though and see if I can't get it working correctly this time. Thanks for the response.

Sign In or Register to comment.