“Unable to determine application identity of the c

2019-06-14 01:38发布

问题:

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;

    ****