When my Prism 6 WPF modular application using Unity is starting then "Prism.Modularity.ModuleTypeLoadingException" in Prism.Wpf.dll is thrown. Below is screen shot of the exception:
As you can see the exception throws when Bootstrepper.Run method is called. Below is the code of the Botstrapper:
namespace FlowmeterConfigurator
{
class Bootstrapper : UnityBootstrapper
{
protected override DependencyObject CreateShell()
{
return Container.Resolve<MainWindow>();
}
protected override void InitializeShell()
{
Application.Current.MainWindow.Show();
}
protected override IModuleCatalog CreateModuleCatalog()
{
return new ConfigurationModuleCatalog();
}
}
}
Solution of my application consists of three projects: main WPF project created with Prism Template Pack as Prism Unity App and two modules, each of which is created with Prism Template Pack as Prism Module. Both of the modules are registered in App.config file, please see below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="modules" type="Prism.Modularity.ModulesConfigurationSection, Prism.Wpf"/>
</configSections>
<modules>
<module assemblyFile="Authorization.dll" moduleType="Authorization.AuthorizationModule, Authorization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" moduleName="AuthorizationModule" startupLoaded="true" />
<module assemblyFile="Calibration.dll" moduleType="Calibration.CalibrationModule, Calibration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" moduleName="CalibrationModule" startupLoaded="true" />
</modules>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
The first module is called Authorization and its class is caled AuthorizationModule:
namespace Authorization
{
[Module(ModuleName = "AuthorizationModule", OnDemand = false)]
public class AuthorizationModule : IModule
{
. . . . .
}
}
The second module is called Calibration and its class is called CalibrationModule:
namespace Calibration
{
[Module(ModuleName = "CalibrationModule", OnDemand = false)]
public class CalibrationModule : IModule
{
. . . . .
}
}
When my application is starting then MainWindow is displayed for short time (less then 1 second) and after this short time interval ModuleTypeLoadingException related to CalibrationModule is thrown. It looks like that type for AuthorizationModule was loaded succsessfully but loading of type for CalibrationModule fails. Please help me to eliminate this error.
P.S. I've not defined any instance of IModuleManager in my application. May be I must define it somewhere in my application?