Search code examples
xamarin.androidinversion-of-controlmvvmcross

Using MvvmCross 5.6 NavigationService with autofac IoC


I am undergoing an mvvmcross upgrade from 4.* to 5.6. This is in a Xamarin.Android project.

Autofac is registered as the IoT container and has been since day 1.

During the upgrade I have had to inject IMvxNAvigationService into a bunch of core services. These services are registered in CreateIocProvider in my setup class.

Now at runtime I am receiving the following:

Cannot resolve parameter 'MvvmCross.Core.Navigation.IMvxNavigationService navService' of constructor

How do I ensure that the underlying navigation service is registered in time? I cannot find anything in the docs.

I have tried swapping autofac for the Mvx IoC container which seemed to solve the problem but had to revert as it doesn't support registration of abstract classes.

Cheers


Solution

  • There does not seem to be a way around my specific issue.

    To resolve I ended up removing Autofac and registering every service/component, including the abstract's individually, using the simple IoC container.