“Unable to determine application identity of the caller” for ViewModelLocator

和自甴很熟 提交于 2020-01-14 06:42:11

问题


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; 
}

回答1:


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;

    ****


来源:https://stackoverflow.com/questions/19589446/unable-to-determine-application-identity-of-the-caller-for-viewmodellocator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!