I have an iOS app, developed with Xamarin.iOS, that is using Ninject 3.3.0 for IoC. I am able to bind interfaces and implementations without issue, but I get a PlatformNotSupportedException
on resolving those bindings with IResolutionRoot.Get<T>()
. I am launching to a simulator on a connected Macbook. I have created a test (blank) iOS app to demonstrate the issue. Here are the relevant lines:
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
...
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
...
var kernel = new StandardKernel();
kernel.Bind<IFoo>().To<Foo>();
var test = kernel.Get<IFoo>(); //exception thrown here
return true;
}
}
Here's the top of the stack trace (can provide more):
" at System.Reflection.Emit.DynamicMethod..ctor (System.String name, System.Type returnType, System.…"
According to this site, the kernel creates these DynamicMethod's for its bindings. Since Ninject is supported by .Net Standard 2.0, why am I getting this exception from such a simple operation?