Mvvmcross: MvxIoCResolveException Exception when back button clicked

Created on 27 Jun 2018  路  5Comments  路  Source: MvvmCross/MvvmCross

Since I upgraded my Xamarin Forms app to MvvmCross v6.1.2 I get always this exception on Android when I click on the back button of the device. The Button of the navigation bar works fine. Forward navigation is fine as well.

MvvmCross.Exceptions.MvxIoCResolveException: Failed to resolve type MvvmCross.Forms.Presenters.IMvxFormsPagePresenter

In this branch the error occurs: https://github.com/NPadrutt/MoneyFox.Windows/tree/mvvmcrossBackButtonIssue

Most helpful comment

This fails because IMvxFormsPagePresenter is not registered in the default setup. In the meantime you can use a workaround - register the IMvxFormsPagePresenter that is created manually in your Android Setup class:

protected override IMvxFormsPagePresenter CreateFormsPagePresenter(IMvxFormsViewPresenter viewPresenter)
{
    var formsPresenter = base.CreateFormsPagePresenter(viewPresenter);
    Mvx.RegisterSingleton(formsPresenter);
    return formsPresenter;
}

All 5 comments

Yea, i also get these exception. I work with MvxMasterDetailPage

This fails because IMvxFormsPagePresenter is not registered in the default setup. In the meantime you can use a workaround - register the IMvxFormsPagePresenter that is created manually in your Android Setup class:

protected override IMvxFormsPagePresenter CreateFormsPagePresenter(IMvxFormsViewPresenter viewPresenter)
{
    var formsPresenter = base.CreateFormsPagePresenter(viewPresenter);
    Mvx.RegisterSingleton(formsPresenter);
    return formsPresenter;
}

Thanks @MartinZikmund. The workaround works.

Hey @nickrandolph, am I right if I say this was solved in #2972?

Yes I do believe so. Let's wait to see the next release and then close once verified

Was this page helpful?
0 / 5 - 0 ratings