I have 2 pages: MainPage and Page2 . I have a transition to MainPage :

 public MainPage() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; this.Loaded += (a, b) => { Frame.Navigate(typeof(Page2)); }; } 

When I launch the application through Visual Studio, everything works well, when I open it on the phone or in the emulator myself, the application crashes during the transition.

Tell me, please, what am I doing wrong? If I do it wrong, tell me how it should be.

    1 answer 1

    Try this:

     Loaded += async ( a, b ) => { await Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Low, () => { Frame.Navigate( typeof( Page2 ) ); } ); };