I created with VS2017 a cross-platform App(Xamarin Forms) with the template set to Blank App, Platform Android, UI Tech Xamarin.Forms, Code Sharing .NET Standard. All builds and runs and displays "Welcome to Xamarin Froms".
I added the Portable.Ninject package to both the .NET standard PCL project and the Android project. Created the following Test class and interface
public class Test : ITest
{
public string name { get; set; }
}
public interface ITest
{
string name { get; set; }
}
A NinjectModule class
public class modules : NinjectModule
{
public override void Load()
{
Bind<ITest>().To<Test>();
}
}
and in the class App:Application and added kernel creation in the constructor
public App ()
{
InitializeComponent();
var settings = new NinjectSettings();
settings.LoadExtensions = false;
var mods = new modules();
var kernel = new StandardKernel(mods);
var test = kernel.Get<ITest>();
MainPage = new App12.MainPage();
}
When ran an ArgumentNULLException. Parameter name:path1 occurs at the new StanardKernel( new modules() ).
Any help will be appreciated. I have tried the Ninject Nuget package, creating the StandardKernel in the android project MainActivity:Oncreate, deleting packages, bin and obj folders ... all with the same result
Addition :- Separated the instantiate of modules class the following is watch window. Shouldn't the Binding list have a count of 1 ?
- mods {App12.modules} App12.modules
- base {Ninject.Modules.NinjectModule} Ninject.Modules.NinjectModule
+ base {Ninject.Syntax.BindingRoot} Ninject.Syntax.BindingRoot
+ Bindings Count = 0 System.Collections.Generic.List<Ninject.Planning.Bindings.IBinding>
Kernel (null) Ninject.IKernel
Name "App12.modules" string
+ Non-public members