Resolution fails using ModuleManager

Topics: Prism v1, Prism v2 - WPF 3.5
Jun 20, 2009 at 2:52 AM

I have been working through the changes required to upgrade from V1 to V2  (Feb2008 release)

After initial startup, the application loads two modules.  Based on the user's selected functionality, all other modules are loaded on demand.

For the upgrade testing, I've  replaced  IModuleEnumerator with IModuleCatalog;  I also replaced the IModuleLoader with IModuleManager.
I am now receiving exceptions that the moduleManager cannot be resolved.

- exception {"Resolution of the dependency failed, type = \"PET.MasterViewManager.Views.IHostPresenter\", name = \"NVSHostPresenter\". Exception message is: The current build operation (build key Build Key[PET.MasterViewManager.Views.NVSHostPresenter, NVSHostPresenter]) failed: The parameter moduleManager could not be resolved when attempting to call constructor PET.MasterViewManager.Views.NVSHostPresenter(Microsoft.Practices.Composite.Regions.IRegionManager regionManager, Microsoft.Practices.Unity.IUnityContainer container, Microsoft.Practices.Composite.Events.IEventAggregator eventAggregator, Microsoft.Practices.Composite.Modularity.IModuleManager moduleManager, Microsoft.Practices.Composite.Modularity.IModuleCatalog moduleCatalog, Microsoft.Practices.Composite.Logging.ILoggerFacade logger, PET.MasterViewManager.Views.INVSHostView view).(Strategy type BuildPlanStrategy, index 3)"} System.Exception {Microsoft.Practices.Unity.ResolutionFailedException}

I have a master "controller" module which has two host view/presenters.  Each instance of a host presenters needs to have the ability to load modules/views on an as per need bases.  
This is the constructor for a "hostPresenter":  
       public NVSHostPresenter(IRegionManager regionManager,
                              IUnityContainer container,
                              IEventAggregator eventAggregator,
                              IModuleManager moduleManager,
                              IModuleCatalog moduleCatalog,
                              ILoggerFacade logger,
                              INVSHostView view)
            : base(regionManager,
            _view = view;
How has the ModuleManager changed?    Any insight on why this would not work?
I see in the QuickStart that ConstructorInjectino is used in ModuleB with IModuleManager 
 public partial class DefaultViewB : UserControl
        private readonly IModuleManager moduleManager;
        public DefaultViewB(IModuleManager moduleManager)
            this.moduleManager = moduleManager;
        private void OnLoadModuleCClick(object sender, RoutedEventArgs e)
Any help is appreciated.

Jun 23, 2009 at 6:35 PM

Hi Tracy,


You should be able to inject the instance of the IModuleManager implementation that your application uses into your Presenters as you are doing. One possible reason I this could be failing, is if the call to the BasePresenter is throwing an exception. To check this, you could check the InnerException “chain”, which you could look for InnerExceptionè InnerExceptionèèInnerException(RootException).  Another option to check the RootException could be using the exception.GetRootException() extension method.


Another possible cause could be that the IModuleManager service implementation was not added to the Bootstrapper. So if the above suggestion does not work you could check if it was correctly added.


Note:  In Prism-v2 there is no need to use module catalog to load modules on demand. You just need the module’s name. You can read more about that here.


Please let me know if this helps.


Damian Schenkelman

Feb 18, 2010 at 9:06 AM

I had a similar (or the same?) problem with a controller not being able to be resolved. Problem could be detected by setting VS to break on all CLR exceptions. I had a similar method like yours:


private void OnLoadModuleCClick(object sender, RoutedEventArgs e)


Changed private to public and it worked :-)

Probably too late for you, just letting people know who land on this thread ;)