App.Current.MainPage NullReferenceException in Constructor of MainPageModel
问题 On the loading of MainPage , I am pushing another page from Constructor of MainPageModel . It throws NullReferenceException in MainPageModel . This is my code MainPage constructor public MainPage() { InitializeComponent(); Title = "MainPage"; BindingContext = new MainPageViewModel(); } MainPageModel constructor public MainPageViewModel() { App.Current.MainPage.Navigation.PushAsync(new HomePage()); //Exception //CommandMenu1 = new Command(async () => await NavigateNext()); } How can I solve