I am unable to use Portable.Ninject in Xamarin.Mac project.
I am creating a container like this:
public class MainClass
{
public static StandardKernel Container { get; set; }
static void Main(string[] args)
{
var kernel = new StandardKernel(new CoreModule());
Container = kernel;
NSApplication.Init();
NSApplication.Main(args);
}
}
CoreModule is this:
public class CoreModule: NinjectModule
{
public override void Load()
{
Bind<ISettings>().To<EyeLeoSettings>().InSingletonScope ();
}
}
And when I am trying to use it in AppController constructor as a service-locator:
private ISettings _settings;
public AppController()
{
_settings = MainClass.Container.Get<ISettings> ();
}
I get NullReferenceException. Here are a few lines from a stack trace:
System.NullReferenceException: Object reference not set to an instance of an object at at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.get_ParentDefinitionMethodInfo () at at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.GetParentDefinition (System.Reflection.MethodInfo,System.Reflection.BindingFlags) ...
Please let me if using Portable.Ninject is possible in Xamarin.Mac applications. Thank you.