InitializeModules Fail

Topics: Prism v2 - Silverlight 3
Feb 13, 2010 at 10:52 AM

I'm trying to use VS2010 .NET 4 and Silverlight4 with Prizm.

I'm getting an exception like shown below from UnityBootStrapper.cs

I followed Mike Taulty's Videos to the letter.

This code: manager = this.Container.Resolve<IModuleManager>();  Steps directly into the constructor for ModuleInitializer(IServiceLocator,ILoggerFacade) which sets the servicelocator and loggerfacade then returns. The result is manager is not initialized and is still null.

The code is below. Do I have the wrong Prizm references?

<font face="Consolas" size="2" color="#0000ff"><font face="Consolas" size="2" color="#0000ff"><font face="Consolas" size="2" color="#0000ff">

protected virtual void InitializeModules(){

IModuleManager manager;


</font></font></font><font face="Consolas" size="2" color="#0000ff"><font face="Consolas" size="2" color="#0000ff">


</font></font><font face="Consolas" size="2" color="#0000ff">





     manager = this.Container.Resolve<IModuleManager>();  <<<------- This code does not return an ImoduleManager


catch (ResolutionFailedException ex)


if (ex.Message.Contains("IModuleCatalog"))   {throw new InvalidOperationException(Resources.NullModuleCatalogException);}


<font face="Consolas" size="2"><font face="Consolas" size="2">




</font></font><font face="Consolas" size="2">




Feb 16, 2010 at 11:42 AM

Hi Erick,

The line you mentioned steps into the ModuleInitializer’s constructor, because the ModuleInitializer is a dependency of the ModuleManager. Therefore it is created by the Unity container because it is the first time it is being requested. However after that it should also step into the ModuleManager’s constructor:

public ModuleManager(IModuleInitializer moduleInitializer, IModuleCatalog moduleCatalog, ILoggerFacade loggerFacade)

Please provide the Stack Trace and the exception message you are getting, and if possible a small sample application that reproduces this error so we can help you troubleshoot your issue.

You could also compare your application’s Bootstrapper with the one provided with any of the Prism Quickstarts to check for any possible differences.

Please let me know if this helps.

Damian Schenkelman


Feb 17, 2010 at 5:28 AM

Thanks for responding,

Actually it was a major screw up by me. While adding modularity to an existing solution with Prizm I completely forgot that my web project hosting the Silverlight was still pointing to the old Silverlight App that was the root visual and not my Shell application. When I added the Shell application it became the Startup project and all hell broke loose, no xap, no page to host it etc.

So the good news is I have a basic modular solution working with VS 2010 Beta 2 and Silverlight 4. So far so good.

Eric Kleeman

Feb 23, 2010 at 4:25 PM

Hi Eric,

Have you tried the version of CAL bebuilt against .NET4 SL4 posted on Composure?

I'd be intersted to hear any feedback if you decide to give that a try.


Ben Stabile