无法确定呼叫者的应用程序标识? [英] Unable to determine application identity of the caller?

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

问题描述

我写在VS2010为Windows Phone的一个Silverlight应用程序支点。我只是说从MSDN 示例代码这里。现在,每当我重新加载设计时我得到一个异常:

I'm writing a Silverlight pivot app in VS2010 for Windows Phone. I just added the example code from msdn here. Now every time I reload the designer I get an exception:

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

Unable to determine application identity of the caller.

在System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope范围,种类appEvidenceType)

at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type appEvidenceType)

在System.IO.IsolatedStorage.IsolatedStorageFile.GetStore (IsolatedStorageScope范围,种类applicationEvidenceType)

at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type applicationEvidenceType)

在System.IO.IsolatedStorage.IsolatedStorageSettings.get_ApplicationSettings()在SettingsSample.AppSettings..ctor(c)中
: ..\Settings.cs:34行

at System.IO.IsolatedStorage.IsolatedStorageSettings.get_ApplicationSettings() at SettingsSample.AppSettings..ctor() in C:..\Settings.cs:line 34

这是在Visual Studio中/ Windows Phone的SDK中的错误?

Is this a bug in Visual Studio/Windows Phone SDK?

这是在第34行的构造函数的代码:

This is the code in the constructor at line 34:

public AppSettings()
    {
        // Get the settings for this application.
        try
        {
            settings = IsolatedStorageSettings.ApplicationSettings;
        }
        catch (System.Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }



我添加在try-catch看看是怎么回事上。

I added the try-catch to see what was going on.

我怀疑的Visual Studio(来电)正在试图运行的代码,但没有应用程序(应用程序标识)相关联,因此它失败。也许?

I suspect that Visual Studio(the caller) is attempting to run the code but there is no application(application identity) associated, so it fails. Maybe?

有什么想法?

推荐答案

您需要添加检查 DesignerProperties.IsInDesignTool 以代码因为在Visual Studio或Expression Blend中访问IsolatedStorageSettings是无效的。

You need to add a check to DesignerProperties.IsInDesignTool to that code since accessing IsolatedStorageSettings in Visual Studio or Expression Blend is invalid.

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

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

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