Prism.Container.Extensions
Prism.Container.Extensions copied to clipboard
Incompatability with Prism 8.1.97
Hi, first off, thanks for the work on this package.
I had been using the latest 7.2 version for a while, but came across a bug in the main Prism.Forms package that was blocking me, so attempted to update all my packages to the latest 8.x versions. The packages I installed were:
Prism.DryIoc.Extensions v8.0.62 Prism.Forms.Extended v8.0.62 Shiny.Prism v8.0.62
I came across another bug in the main Prism.Forms package that blocked me as well, and saw that the dependencies all had Prism.Forms (>= 8.0.0.1909), so I tried adding Prism.Forms v8.1.97 manually to the project (which I didn't have before).
It builds fine, but on starting the app I get the following exception :
Prism.Ioc.ContainerResolutionException: An unexpected error occurred while resolving 'Prism.Services.IPageDialogService' ---> DryIoc.ContainerException: code: Error.UnableToResolveUnknownService;
message: Unable to resolve Prism.AppModel.IKeyboardMapper as parameter "keyboardMapper" (IsSingletonOrDependencyOfSingleton)
in resolution root Singleton Prism.Services.PageDialogService: Prism.Services.IPageDialogService FactoryId=180 (IsSingletonOrDependencyOfSingleton, IsResolutionCall)
from container with scope {Name=null}
with Rules with {TrackingDisposableTransients, UseDynamicRegistrationsAsFallbackOnly, FuncAndLazyWithoutRegistration, SelectLastRegisteredFactory} and without {ThrowOnRegisteringDisposableTransient, UseFastExpressionCompilerIfPlatformSupported}
with FactorySelector=SelectLastRegisteredFactory
with Made={FactoryMethod=ConstructorWithResolvableArguments}
Where no service registrations found
and no dynamic registrations found in 1 of Rules.DynamicServiceProviders
and nothing found in 0 of Rules.UnknownServiceResolvers
at DryIoc.Throw.It (System.Int32 error, System.Object arg0, System.Object arg1, System.Object arg2, System.Object arg3) [0x00000] in /_/src/DryIoc/Container.cs:13580
at DryIoc.Container.TryThrowUnableToResolve (DryIoc.Request request) [0x0006d] in /_/src/DryIoc/Container.cs:1088
at DryIoc.Container.DryIoc.IContainer.ResolveFactory (DryIoc.Request request) [0x00072] in /_/src/DryIoc/Container.cs:1068
at DryIoc.ReflectionFactory.CreateExpressionOrDefault (DryIoc.Request request) [0x0033c] in /_/src/DryIoc/Container.cs:10917
at DryIoc.Factory.GetExpressionOrDefault (DryIoc.Request request) [0x002c6] in /_/src/DryIoc/Container.cs:10225
at DryIoc.Container.ResolveAndCache (System.Int32 serviceTypeHash, System.Type serviceType, DryIoc.IfUnresolved ifUnresolved) [0x0008f] in /_/src/DryIoc/Container.cs:391
at DryIoc.Container.DryIoc.IResolver.Resolve (System.Type serviceType, DryIoc.IfUnresolved ifUnresolved) [0x0011c] in /_/src/DryIoc/Container.cs:356
at DryIoc.Container.DryIoc.IResolver.Resolve (System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, DryIoc.Request preResolveParent, System.Object[] args) [0x00039] in /_/src/DryIoc/Container.cs:428
at DryIoc.Resolver.Resolve (DryIoc.IResolver resolver, System.Type serviceType, System.Object[] args, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, System.Object serviceKey) [0x00000] in /_/src/DryIoc/Container.cs:8084
at Prism.DryIoc.DryIocContainerExtension.Resolve (System.Type type, System.ValueTuple`2[System.Type,System.Object][] parameters) [0x0001c] in /_/external/Prism/src/Containers/Prism.DryIoc.Shared/DryIocContainerExtension.cs:294
--- End of inner exception stack trace ---
at Prism.DryIoc.DryIocContainerExtension.Resolve (System.Type type, System.ValueTuple`2[System.Type,System.Object][] parameters) [0x00053] in /_/external/Prism/src/Containers/Prism.DryIoc.Shared/DryIocContainerExtension.cs:298
at Prism.DryIoc.DryIocContainerExtension.Resolve (System.Type type) [0x00000] in /_/external/Prism/src/Containers/Prism.DryIoc.Shared/DryIocContainerExtension.cs:272
at Prism.Ioc.IContainerProviderExtensions.Resolve[T] (Prism.Ioc.IContainerProvider provider) [0x00000] in /_/src/Prism.Core/Ioc/IContainerProviderExtensions.cs:18
at XamarinMobileBase.BasePageViewModel..ctor () [0x0008e] in C:\Users\Work\XamDev\MyApp\XamarinMobileBase\Shared\ViewModels\BasePageViewModel.cs:30
at MyApp.ViewModels.LoginPageViewModel..ctor (Prism.Navigation.INavigationService navigationService) [0x00000] in C:\Users\Work\XamDev\MyApp\MyApp\ViewModels\LoginPageViewModel.cs:40
at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936
at DryIoc.ReflectionTools.TryRethrowWithPreservedStackTrace (System.Exception ex) [0x00016] in /_/src/DryIoc/Container.cs:13633
at DryIoc.Interpreter.TryInterpretAndUnwrapContainerException (DryIoc.IResolverContext r, FastExpressionCompiler.LightExpression.Expression expr, System.Boolean useFec, System.Object& result) [0x0002f] in /_/src/DryIoc/Container.cs:2863
at DryIoc.Container.ResolveAndCacheKeyed (System.Int32 serviceTypeHash, System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Object scopeName, System.Type requiredServiceType, DryIoc.Request preResolveParent, System.Object[] args) [0x001e1] in /_/src/DryIoc/Container.cs:521
at DryIoc.Container.DryIoc.IResolver.Resolve (System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, DryIoc.Request preResolveParent, System.Object[] args) [0x00042] in /_/src/DryIoc/Container.cs:430
at DryIoc.Resolver.Resolve (DryIoc.IResolver resolver, System.Type serviceType, System.Object[] args, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, System.Object serviceKey) [0x00000] in /_/src/DryIoc/Container.cs:8084
at Prism.DryIoc.DryIocContainerExtension.Resolve (System.Type type, System.ValueTuple`2[System.Type,System.Object][] parameters) [0x0001c] in /_/external/Prism/src/Containers/Prism.DryIoc.Shared/DryIocContainerExtension.cs:294
--- End of inner exception stack trace ---
at Prism.DryIoc.DryIocContainerExtension.Resolve (System.Type type, System.ValueTuple`2[System.Type,System.Object][] parameters) [0x00053] in /_/external/Prism/src/Containers/Prism.DryIoc.Shared/DryIocContainerExtension.cs:298
at Prism.PrismApplicationBase.<ConfigureViewModelLocator>b__19_0 (System.Object view, System.Type type) [0x00078] in /_/src/Forms/Prism.Forms/PrismApplicationBase.cs:120
at Prism.Mvvm.ViewModelLocationProvider.AutoWireViewModelChanged (System.Object view, System.Action`2[T1,T2] setDataContextCallback) [0x0003a] in /_/src/Prism.Core/Mvvm/ViewModelLocationProvider.cs:107
at Prism.Mvvm.ViewModelLocator.OnAutowireViewModelChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00019] in /_/src/Forms/Prism.Forms/Mvvm/ViewModelLocator.cs:40
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:512
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:446
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0004d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:374
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:349
at MyApp.Views.LoginPage.InitializeComponent () [0x00056] in C:\Users\Work\XamDev\MyApp\MyApp\obj\Debug
etstandard2.1\Views\LoginPage.xaml.g.cs:38
at MyApp.Views.LoginPage..ctor () [0x00009] in C:\Users\Work\XamDev\MyApp\MyApp\Views\LoginPage.xaml.cs:15
I've had a bit of a look through the latest Prism changes, and suspect the issue is related to the changes made here: https://github.com/PrismLibrary/Prism/pull/2322 Where IKeyboardMapper was added.
Just putting this out there in case anyone else is getting the same issue
I ended up figuring out a workaround while writing out the issue, but thought I'd still put this up and leave my workaround here for discoverability.
In this PR: https://github.com/PrismLibrary/Prism/pull/2322 A keyboard mapper was registered as a singleton. https://github.com/PrismLibrary/Prism/pull/2322/files#diff-0f41a729d11fcce3de9ef2724a0dda502b872121ab1f25a79996179c4731c91a
By adding this same registration in my app, it fixed the exception I got. Did some quick testing and my app is working as expected so far.
If I get time I'll submit a change to this project as a PR.
Yes, I'm hitting the same issue. Not sure why you closed it, probably should've stayed open until fixed. I wanted to provide a PR, but realized it needs Prism.Forms
updating to latest version, so I'll leave it to Dan, probably.
Thanks all!
Good point, I'll reopen it, and Dan can close it if he wants to.