Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Null Exception when calling Navigation.* (Push, Pop, PopToRoot)

$
0
0

Forgive me if this question has been answered before, but I did some searching and all I could find is some iOS stuff.

I'm working on an app where you can take a photo and upload it to a cloud management system (unimportant). It's cross-platform for the big three (Android, iOS, WinPhone). I'm using the latest stable XLabs for some of the media options (again, should be unimportant).

I'm running into an issue where some (not all) of my ViewModel classes get null exceptions when doing Navigation.* (PopAsync, PopToRootAsync, PushAsync, etc). It's throwing a null reference exception for the shared code project, with no other details than "Object reference not set to an instance of an object." No stack trace or anything. I'm calling it via a simple "await Navigation.PopToRootAsync();" after doing some logic to save the photo.

The odd part is that I can rebase the nav stack just fine, i.e. I can get back to root with:

var newRoot = App.GetMainPage();
Application.Current.MainPage = newRoot;

However, if I try to use that new root with Navigation.PushAsync(newRoot); or just call Navigation.PopToRootAsync();, I get the null exception.

Anyone else experiencing these symptoms? Known workarounds other than rebasing the MainPage?

Thanks in advance!


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>