-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigation to a empty Xamarin.Forms.TabbedPage results in NullReferenceException #2576
Comments
A TabbedPage is required to have a Tab. Prism always assumes there is as least one. I'm not completely opposed to changing this, but I'm not sure it really makes sense to. It's an easy fix for this particular issue regarding OnNavigatedTo/From. But, this is not an assumption I want to change throughout the entire NavigationService. @dansiegel what are your feelings on this? |
I submitted a PR to fix this. If @dansiegel approves we can add support for this specific scenario. |
@brianlagunas
Thank you. |
Fixed |
Description
Navigation to a Tabbed Page that doesn't have any tabs will result in a NullReferenceException. Adding a tab in Xaml or using data binding with an ItemsSource/ItemTemplate will work. See the TheTabbedPage.xaml file, at the top you can un-comment the xaml to remove the exception.
This occurs on iOS and Android
I suppose that an empty tab page isn't an overly common issue with runtime, however, during development when I am working through my business object development work the lack of items in a collection isn't rare. This particular issue took me quite some time determine it was simply an issue of a lack of items in my ItemsSource because I didn't have any of that plumbed up yet.
Steps to Reproduce
Expected Behavior
No exception. Xamarin.Forms on it's own has no issues displaying an empty TabbedPage.
Actual Behavior
Navigation fails with the following exception captured in the INavigationResult object:
Basic Information
Reproduction Link
TabPageExcept.zip
The text was updated successfully, but these errors were encountered: