"无法确定呼叫者&QUOT的应用程序标识;对于ViewModelLocator [英] "Unable to determine application identity of the caller" for ViewModelLocator

查看:210
本文介绍了"无法确定呼叫者&QUOT的应用程序标识;对于ViewModelLocator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在App.xaml中,我有一个错误在定义ViewModelLocator。应用程序启动并运行良好,但它让我很烦,在Studio。想知道,有什么可以成为理由。亮的行是



 < VM:ViewModelLocator X:键=ViewModelLocatorD:IsDataSource =真/> 



错误:




错误1无法确定呼叫者的应用程序标识。




如果为VM内得到:ViewModelLocator,有没有错误的存在迹象。我应该重新检查我所有的ViewModels,并添加IsoStorage designtime保护?



 如果(!System.ComponentModel.DesignerProperties.IsInDesignTool)
{
设置= IsolatedStorageSettings.ApplicationSettings;
}


解决方案

在万一有人有相同问题。只是建议:尽量在Blend中打开你的项目并附加VS它。你会立即看到,这里的问题是(通常,它是关于designtime期间访问IsoStorage)



编辑:更准确,加入的designMode检查解决我的问题高亮。

 公共ViewModelLocator()
{
如果(ViewModelBase.IsInDesignModeStatic)
返回;

****


In app.xaml, i have an error while defining ViewModelLocator. App launches and runs fine, but it annoys me in Studio. Wondering, what can be a reason. Highlighted line is

<vm:ViewModelLocator x:Key="ViewModelLocator" d:IsDataSource="True"/>

Error:

Error 1 Unable to determine application identity of the caller.

If to get inside of vm:ViewModelLocator, there's no sign of errors there. Should i re-check all my viewmodels and add IsoStorage designtime protection?

if (!System.ComponentModel.DesignerProperties.IsInDesignTool)
{
    settings = IsolatedStorageSettings.ApplicationSettings; 
}

解决方案

In case someone has the same issue. Just recommendation: try to open your project in Blend and attach VS to it. You'll immediately see, where problem is (usually, it is about accessing IsoStorage during designtime).

EDIT: to be more accurate, adding DesignMode check solves my problem with highlighting.

public ViewModelLocator()
    {
        if (ViewModelBase.IsInDesignModeStatic)
            return;

    ****

这篇关于&QUOT;无法确定呼叫者&QUOT的应用程序标识;对于ViewModelLocator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆