错误提示信息:
An exception occurred while initializing module 'IndexModule'.
- The exception message was: Activation error occured while trying to get instance of type IndexModule, key ""
Check the InnerException property of the exception for more information. If the exception occurred
while creating an object in a DI container, you can exception.GetRootException() to help locate the
root cause of the problem.
因为在'IndexModule'中存在两种初始化方法,导致加载这个Module的时候框架不知道应该去执行哪个方法,故此引发的异常,特别注意Bootstrapper这里的IModuleCatalog方法因为该方法只包含'IndexModule'故此只对'IndexModule'进行了限制,在其他的Module中可以定义多个初始化方法并无限制。
IRegionViewRegistry 和IRegionManager的作用在加载Module上是相同的,框架内部做了映射!

Bootstrapper
public class Bootstrapper:UnityBootstrapper
{
protected override DependencyObject CreateShell()
{
Shell shell = Container.Resolve<Shell>();
Application.Current.RootVisual = shell;
return shell;
}
protected override IModuleCatalog GetModuleCatalog()
{
ModuleCatalog catalog = new ModuleCatalog()
.AddModule(typeof(IndexModule));
return catalog;
}
}

Code
private readonly IRegionViewRegistry regionViewRegistry;
public LoginedContainerModule(IRegionViewRegistry regionViewRegistry)
{
this.regionViewRegistry = regionViewRegistry;
}
private readonly IRegionManager regionManager;
public LoginedContainerModule(IRegionManager regionManager)
{
this.regionManager = regionManager;
}
这两个保留其一即可解决此问题。