InnerModuleInfoLoader InvalidCastException

Topics: Prism v2 - WPF 3.5
Jan 5, 2010 at 5:15 PM

After returning from a 2 week vacation, I suddenly started seeing the following exception from my Prism application from the call to Boostrapper.Run():

System.InvalidCastException {"Unable to cast transparent proxy to type 'InnerModuleInfoLoader'."}

With the following call stack:

at Microsoft.Practices.Composite.Modularity.DirectoryModuleCatalog.InnerLoad()
   at Microsoft.Practices.Composite.Modularity.ModuleCatalog.Load()
   at Microsoft.Practices.Composite.Modularity.ModuleCatalog.Initialize()
   at Microsoft.Practices.Composite.Modularity.ModuleManager.Run()
   at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.InitializeModules()
   at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
   at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run()
   at Mobile.App..ctor()
   at Mobile.App.Main()


My bootstrapper class is:

    internal class Bootstrapper : UnityBootstrapper
        protected override IModuleCatalog GetModuleCatalog()
            LoggerFacade.Log("Loading modules", Category.Debug, Priority.Medium);
            DirectoryModuleCatalog moduleCatalog = new DirectoryModuleCatalog();
            moduleCatalog.ModulePath = @"Modules";
            return moduleCatalog;

        protected override DependencyObject CreateShell()
            LoggerFacade.Log("Loading logger", Category.Debug, Priority.Medium);

            LoggerFacade.Log("Showing shell", Category.Debug, Priority.Medium);
            Shell shell = new Shell();

            return shell;

In my Modules directory, I have 2 assemblies, both of which contain a Module.

Has anyone seen this before?  Any ideas to the cause or fix of this behavior?


Jan 5, 2010 at 7:41 PM

I think I figured it out.  We had 2 versions of the same assembly, each had a different public key.


Nov 29, 2011 at 6:45 PM
dmonks wrote:

I think I figured it out.  We had 2 versions of the same assembly, each had a different public key.


We're encountering the same error, would you mind elaborating on what you figured out?  Where were the 2 versions located, and are you referring to your module assembly or something else?  Any insight will be highly appreciated.


Dec 1, 2011 at 9:13 PM

Sorry I didn't provide more detail in my original post.  I thoughtlessly assumed that I ended up in a weird situation that no one else would.

As best as I can remember almost it was one of the two scenarios -

1.  We had 2 different versions of one of our module.dlls in a directory.


2.  We had 2 different versions of Microsoft.Practices.ObjectBuilder.dll registered on the machine.


Good Luck !

Dec 7, 2011 at 11:59 PM

actually, I was thinking about your answer and it kinda pointed me to the right direction, so thanks! 

In our case, our prism dlls were in the wrong location, we were hoping not to have to register them in the GAC.  Error disappeared after registering them properly.

Dec 8, 2011 at 2:14 PM

Glad you found a solution, but I was able to get my code working without using the GAC.  So there should be a way to do it avoiding the GAC.