对于ViewModelLocator,“无法确定调用者的应用程序标识”
在app.xaml中,我在定义ViewModelLocator时出错。 应用程序启动并运行良好,但它在Studio中让我很烦。 想知道,这可能是一个原因。 突出显示的行是
错误:
错误1无法确定调用方的应用程序标识。
如果要进入vm:ViewModelLocator,那里没有任何错误迹象。 我应该重新检查我的所有视图模型并添加IsoStorage设计时保护吗?
if (!System.ComponentModel.DesignerProperties.IsInDesignTool) { settings = IsolatedStorageSettings.ApplicationSettings; }
万一有人有同样的问题。 只是建议:尝试在Blend中打开您的项目并将VS附加到它。 您将立即看到问题出在哪里(通常是在设计时访问IsoStorage)。
编辑:为了更准确,添加DesignMode检查解决我突出显示的问题。
public ViewModelLocator() { if (ViewModelBase.IsInDesignModeStatic) return; ****