I cannot initalize a module because I receive an error: IModuleManager could not be resolved. This is strange as prior to resolving phase it is registered in PrismApplication.RegisterRequiredTypes().
Originally, the error rises in PrismApplication.InitializeModules() in line 195. If you try to resolve it before this method kicks in (but after instance was registered) same thing happens.
ConfigureModuleCatalog()Initialization of modules is possible.
An error is rised:
Exception thrown at 0x00007FFC31EA5299 (KernelBase.dll) in ElkaUWP.Core.exe: WinRT originate error - 0x80131500 : 'Unity.Exceptions.ResolutionFailedException: Resolution of the dependency failed, type = 'Prism.Modularity.IModuleManager', name = '(none)'.
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The current type, Prism.Ioc.IContainerExtension, is an interface and cannot be constructed. Are you missing a type mapping?
I made a further investigation on this issue.
It seems that IModuleManager could not be resolved because IModuleCatalog could not be solved in the first place.
Workaround:
By overriding RegisterRequiredTypes() i managed to find out that if one replaces RegisterSingleton<>() by Register<>() for IModuleCatalog, the module will be loaded.
Because I need to work with IModuleCatalog only once (and I am not going to use its powerful features from WPF, just for cosmetic project structure splitting) this is okay, as it won't cause memory leak...
I am still trying to understand where the bug lies, but for now I think am missing something essential while browsing code.
Yes UWP cannot load dinamically DLLs so the ModuleManager functionality can be only for project structure purposes.
@totht91 could you elaborate on that?
The problem is that the IContainerExtension is not being registered with the container. So the IModuleManager can't be created. Just add containerRegistry.RegisterInstance(Container) and it should work. Let me know if that works.
@brianlagunas Unfortunately, registering the container in the registry at the beginning of RegisterRequiredTypes() didn't fix the issue.
However, containerRegistry.RegisterInstance((IContainerExtension)Container); does fix it.
Yeah.... sorry, you need to provide the interface containerRegistry.RegisterInstance<IContainerExtension>(Container)
@brianlagunas this does not work as
IContainerProvider is not assignable to IContainerExtension
Not strange because IContainerExtension implements IContainerProvider but not the other way :)
it will work when I do it :)
fixed
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.