Ninject 在 Xamarin 中仅在物理设备上测试时抛出错误
Ninject in Xamarin is throwing an error only when tested on a physical device
我在 Android 和 iOS 之间的共享项目中一直使用 Ninject 没有问题,但是,当我出于测试目的连接 iPhone 时,我收到这个奇怪的错误:
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.
我的代码很简单:
public static Ninject.StandardKernel GetStandardKernel()
{
//var settings = new Ninject.NinjectSettings() { LoadExtensions = false };
var kernel = new Ninject.StandardKernel(new iOS.Ioc.IOSModule());
return kernel;
}
启用 linker 行为 link 一些 sdk 框架只解决了问题
我在 Android 和 iOS 之间的共享项目中一直使用 Ninject 没有问题,但是,当我出于测试目的连接 iPhone 时,我收到这个奇怪的错误:
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.
我的代码很简单:
public static Ninject.StandardKernel GetStandardKernel()
{
//var settings = new Ninject.NinjectSettings() { LoadExtensions = false };
var kernel = new Ninject.StandardKernel(new iOS.Ioc.IOSModule());
return kernel;
}
启用 linker 行为 link 一些 sdk 框架只解决了问题