Closed robloo closed 3 years ago
Thanks for the report. Is the page you're navigating to or from having an OnNavigatingFrom
as well ?
@jeromelaban No, I don't use OnNavigatingFrom() in any of the pages so haven't checked this. I'm also guessing the first page is failing to load which puts navigation in the state that can cause this error. I think it should be possible to load/navigate-to other pages if such an error occurs though.
Current behavior
The code crashes here:
https://github.com/unoplatform/uno/blob/c4eaf68fee3502e5847446251412787ccea67ce7/src/Uno.UI/UI/Xaml/Controls/Frame/Frame.cs#L292
The issue is
Instance
is still null because no Page has been navigated-to/loaded before.This situation likely occurs when the first Page fails to load for some reason. However, Uno should be robust in this situation. If a previous page fails to load, it should still be possible to navigate to another Page.
Expected behavior
According to the
Page.OnNavigatingFrom(NavigatingCancelEventArgs)
docs:https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.page.onnavigatingfrom?view=winrt-19041
Therefore, if the page stack is empty this method call can safely be ignored. Simply check for null before invoking here.
How to reproduce it (as minimally and precisely as possible)
N/A
Workaround
??
Environment
Nuget Package:
Nuget Package Version(s):
Affected platform(s):
IDE:
Relevant plugins:
Anything else we need to know?