我正在使用带有 Unity Extensions 和 MVVM 模式的 Prism 4。
public class Bootstrapper : UnityBootstrapper {
protected override void InitializeShell() {
Application.Current.RootVisual = (UIElement) Shell;
}
protected override DependencyObject CreateShell()
{
return ServiceLocator.Current.GetInstance<Shell>();
}
}
ServiceLocator.Current.GetInstance() 抛出以下异常:
尝试获取 Shell 类型的实例时发生激活错误,密钥“”