System.InvalidOperationException: NavHost cannot be null

ac-lap 71 Reputation points
2024-01-10T18:05:06.2833333+00:00

I have a .net MAUI app published to Play Store, from the Microsoft Appcenter diagnostics I am seeing this exception resulting into crashes in production. I need help to understand why this could be happening and how to fix it.

It has only the following stack trace for all crashes, no other events. Would really appreciate some help to understand this issue.

System.InvalidOperationException: NavHost cannot be null

Microsoft.Maui.Platform.StackNavigationManager.get_NavHost()
Microsoft.Maui.Platform.NavigationViewFragment.OnResume()
AndroidX.Fragment.App.Fragment.n_OnResume(IntPtr , IntPtr )
Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,917 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.