When root view is loaded try navigate to tabbed page using IMvxNavigatingService.Navigate and await the call, app will crash with exception "Cannot replace MainPage".
The reason of the crash is that MvxFormsApplicationDelegate method FinishedLaunching is not calling base.FinishedLaunching, so FormsApplicationDelegate private field "_window" is not initialised, and app crashes at method UpdateMainPage of FormsApplicationDelegate.
MainPage gets replaced
App crash
Version: 5.6.x
Platform:
Facing the same issue. Any fix ?
I'm using workaround for now.
private void InitializeInternalWindow(UIWindow window)
{
var windowField = typeof(FormsApplicationDelegate).GetField("_window", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
windowField.SetValue(this, window);
}
Call this method in FinishedLaunching after you created UIWindow, and pass it there.
@vkonst86 - Thanks. Your workaround works like charm.
@vkonst86 are you able to reproduce this in the playground sample? If so, can you submit a PR with your changes showing how to reproduce the issue
This is fixed in the playground.
@martijn00 can you add the reference source code over here?
Most helpful comment
This is fixed in the playground.