Module Loading problems

Topics: Prism v2 - WPF 3.5
May 17, 2010 at 7:36 PM

I'm having issues with the Microsoft.Practices.Modularity, but only on one of two development machines, and only when I build the project in Debug configuration. On the original developer's machine where this was created, we have no issues.

We're using DirectoryLookup for finding the modules to load, and there are no dependencies on any of the modules. All modules are being loaded at startup. The first module will always load successfully, but the second module will fail to load every time when running in the debugger or with debugger compiled code. It doesn't matter which module I load second, the second module always fails. The error message I get is

"Unable to retrieve the module type PMTools.StatusBar.StatusBar, PMTools.StatusBar, Version=, Culture=neutral, PublicKeyToken=null from the loaded assemblies.  You may need to specify a more fully-qualified type name." When debugging, the content of moduleInfo is below:

This is the content of moduleInfo
DependsOn: Count=0
InitializationMode: WhenAvailable
ModuleName: StatusBar
ModuleType: PMTools.StatusBar.StatusBar, PMTools.StatusBar, Version=, Culture=neutral, PublicKeyToken=Null
Ref: "file:///C:/projects/PMTools/Dev/Shell/bin/Debug/Modules/PMTools.StatusBar.dll"
State: Initializing

All of the module files are located in the C:/projects/PMTools/Dev/Shell/bin/Debug/Modules directory, and we have the post build event to copy them there when they are rebuilt.

If I change the code and define the modules in the app.config file, I get the same error. In app.config, I'm defining the modules like this:

    <module assemblyFile="Modules/PMTools.ModuleA.dll" moduleType="PMTools.ModuleA.ModuleA, PMTools.ModuleA" moduleName="ModuleA" />
    <module assemblyFile="Modules/PMTools.Navigator.dll" moduleType="PMTools.Navigator.Navigator, PMTools.Navigator" moduleName="Navigator" />
    <module assemblyFile="Modules/PMTools.StatusBar.dll" moduleType="PMTools.StatusBar.StatusBar, PMTools.StatusBar" moduleName="StatusBar" />
    <module assemblyFile="Modules/PMTools.Trunnion.dll" moduleType="PMTools.Trunnion.Trunnion, PMTools.Trunnion" moduleName="Trunnion" />


I have read all the posts I can find about this issue, but none of them have led me to an answer. Today, I built the Release version of the code, and it runs correctly in the Release version, so now I'm really puzzled.


Jun 3, 2010 at 8:06 PM


Sorry for the delayed response. Based on our understanding, you may be experiencing this error because you are specifying a non-fully-qualified type for your modules. You can check this thread in which a user experiences a similar problem.

You should also make sure that the assemblies that are being loaded are the correct ones. You could verify this by cleaning the project and deleting the dll files in both machines. You should also check the Build Event to make sure that it is copying the files to the correct folder, depending on the configuration you follow (Debug or Release). The post build event should be something like this:

xcopy "$(TargetDir)*.*" "$(SolutionDir)YourSolutionName\bin\$(ConfigurationName)\Modules\" /Y

If you still can’t solve this, please send us any information you think could help us clarify your situation.

I hope you find this helpful.

Guido Leandro Maliandi