Wpf 未实例化IRequestNavigationService

Wpf 未实例化IRequestNavigationService,wpf,prism,prism-6,Wpf,Prism,Prism 6,在一个正在运行的程序中,我开始出现以下异常: 尝试获取IRegionNavigationService类型的实例时发生激活错误 内部的例外是 InnerException{“当前类型CommonServiceLocator.IServiceLocator是接口,无法构造。是否缺少类型映射?”}System.Exception{System.InvalidOperationException} 由于这是Prism 6平台的一部分,我不知道从哪里开始解决这个问题 当我从存储库更新项目时,问题开始出现

在一个正在运行的程序中,我开始出现以下异常: 尝试获取IRegionNavigationService类型的实例时发生激活错误

内部的例外是 InnerException{“当前类型CommonServiceLocator.IServiceLocator是接口,无法构造。是否缺少类型映射?”}System.Exception{System.InvalidOperationException}

由于这是Prism 6平台的一部分,我不知道从哪里开始解决这个问题

当我从存储库更新项目时,问题开始出现,解决方案文件已损坏。我让程序运行,但是当我选择一个导航到另一个视图的选项时,我得到了一个异常

以下是获取异常的代码:

public class MainMenuViewModel : BindableBase, IRegionManagerAware
{
    public IRegionManager RegionManager { get; set; }


    public MainMenuViewModel()
    {
        CustomerProfileCommand = new DelegateCommand(ExecuteCustomerProfileCommand);
        AdjustmentTypeCommand = new DelegateCommand(ExecuteAdjustmentTypeCommand);
        StreetProfileCommand = new DelegateCommand(ExecuteStreetProfileCommand);
        LocationMaintenanceCommand = new DelegateCommand(ExecuteLocationMaintenanceCommand);
    }

    private void ExecuteLocationMaintenanceCommand()
    {
        RegionManager.RequestNavigate(RegionNames.ContentRegion, NavigationNames.LocationMaintenance);
    }

    private void ExecuteStreetProfileCommand()
    {
        RegionManager.RequestNavigate(RegionNames.ContentRegion, NavigationNames.StreetMaintenance);
    }

    private void ExecuteAdjustmentTypeCommand()
    {
        RegionManager.RequestNavigate(RegionNames.ContentRegion, NavigationNames.AdjustmentTypeMaintenance);
    }

    private void ExecuteCustomerProfileCommand()
    {
        RegionManager.RequestNavigate(RegionNames.ContentRegion, NavigationNames.CustomerProfile);
    }

    public ICommand  CustomerProfileCommand { get; set; }
    public ICommand AdjustmentTypeCommand { get; set; }
    public ICommand StreetProfileCommand { get; set; }
    public ICommand LocationMaintenanceCommand { get; set; }
}
RegionManager由区域行为实例化,并且(使用调试来验证)实际实例化


任何关于我应该从哪里开始的指导都是非常感谢的。

好的,我发现了问题。我已将CommonServiceLocator包升级到2.03。显然,Prism 6.30只适用于1.3.0版。在我做了那个改变之后,程序开始工作。

为解决您自己的问题竖起大拇指。另外,请注意,当前版本的Prism(7.0)确实支持Unity 5,但是,Prism的一个依赖项尚未更新为支持Unity 5,因此,总体而言,您目前仍使用Unity 4.0。是的,我知道新版本的Prism,但我没有找到任何关于从6.3迁移的信息。所以,现在,我坚持我所拥有的。