Xamarin Android TinyIo C .TinyIoCResolutionException Не удается разрешить тип после обновления целевого объекта API до API 28 - PullRequest
0 голосов
/ 06 марта 2020

Я хочу иметь возможность вводить зависимости с моим контейнером Io C, не запуская исключение TinyIoC.TinyIoCResolutionException.

Мое приложение Xamarin Android использует TinyIo C для внедрения зависимостей. При запуске приложения (до того, как что-то еще произойдет) все зависимости регистрируются с помощью container следующим образом:

container.Register<IExampleService, ExampleService>();

Затем я разрешаю зависимости после регистрации в onCreate() метод действий так:

container.Resolve<IExampleService>();

Теперь некоторые зависимости разрешаются нормально, но затем другие выдают:

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)

Я недавно обновил свой Target API до 28, ранее было 21. Я не уверен, что это фактор.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...