I want to be able to inject dependencies with my IoC container without running into the TinyIoC.TinyIoCResolutionException
exception.
My Xamarin Android app is using TinyIoC to inject dependencies. On app start up (before anything else happens) all the dependencies are registered with the container
as so:
container.Register<IExampleService, ExampleService>();
I then resolve the dependencies after registering within the onCreate()
method of activities as so:
container.Resolve<IExampleService>();
Now some dependencies are resolved fine, but then others throw:
TinyIoC.TinyIoCResolutionException
Message = Unable to resolve type: ExamplePackage.ExampleService
Source = Common.Shared.TinyIoC
StackTrace:
at TinyIoC.TinyIoCContainer.ConstructType(System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x000c4] in <e0fa358c835b42dcacf38a6ad3cc70cc>:0
at TinyIoC.TinyIoCContainer.ConstructType(System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.ResolveOptions options) [0x00009] in <e0fa358c835b42dcacf38a6ad3cc70cc>:0
at TinyIoC.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, TinyIoC.TinyIoCContainer container, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options)[0x0003b] in <e0fa358c835b42dcacf38a6ad3cc70cc>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TinyIoCContainer+TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00027] in <e0fa358c835b42dcacf38a6ad3cc70cc>:0
at TinyIoC.TinyIoCContainer.Resolve(System.Type resolveType) [0x00011] in <e0fa358c835b42dcacf38a6ad3cc70cc>:0
at TinyIoC.TinyIoCContainer.Resolve[ResolveType] ()[0x00000] in <e0fa358c835b42dcacf38a6ad3cc70cc>:0
at Common.Shared.IoC.Tiny.Tiny.Resolve[ResolveType] ()[0x00005] in <8ff607064979404aaa60061c0b7e19eb>:0
at Android.App.Activity.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this)[0x00009] in <4a189ea3b82b48a089ac9002b2abc206>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.8(intptr, intptr)
I have recently updated my Target API
to 28, previously it was 21. I'm not sure if this is a factor.