I'm using MvvmCross v6.2.1 in an iOS project and am getting the following exception: MvvmCross.Exceptions.MvxIoCResolveException has been thrown. Failed to resolve type Countr.Core.Services.IMediaManagerService. In an attempt to solve this I added some debugging code to App.cs
using MvvmCross.IoC;
using Countr.Core.ViewModels;
using Countr.Core.Services;
using MvvmCross;
using MvvmCross.ViewModels;
using System.Linq;
namespace Countr.Core
{
public class App : MvxApplication
{
public override void Initialize()
{
CreatableTypes()
.EndingWith("Service")
.AsInterfaces()
.RegisterAsLazySingleton();
CreatableTypes()
.EndingWith("Repository")
.AsInterfaces()
.RegisterAsLazySingleton();
var x = new MediaManagerService();
var y = this.CreatableTypes().FirstOrDefault(t => t.Name == "MediaManagerService");
var z = Mvx.IoCProvider.Resolve<IMediaManagerService>();
RegisterAppStart<ArticlesViewModel>();
}
}
}
The variables x and y are successfully created, i.e., there is no error creating the MediaManagerService and the MediaManagerService is listed in the CreatableTypes() collection. However the code blows up when initializing the variable z, i.e., when executing the Resolve method.
What am I doing wrong?
Mvx.IoCProvider.GetSingleton<IMediaManagerService>()throws the same error? does the exception have an InnerException or it's just that? - fmaccaroni