Search code examples
c#xamarindependency-injectionninject

Ninject in Xamarin is throwing an error only when tested on a physical device


I've been using Ninject with no problem in a shared project between Android and iOS, however, when I connect an iPhone for testing purposes, I get this weird error:

System.InvalidOperationException Error loading Ninject component IModuleLoader No constructor was available to create an instance of the registered implementation type ModuleLoader.

Suggestions: 1) Ensure that the implementation type has a public constructor.

My code is rather simple:

public static Ninject.StandardKernel GetStandardKernel()
{
    //var settings = new Ninject.NinjectSettings() { LoadExtensions = false };
    var kernel = new Ninject.StandardKernel(new iOS.Ioc.IOSModule());
    return kernel;
}

Solution

  • enable linker behaviour to link some sdk frameworks only solved the problem