无法确定来电者的应用程序身份? [英] Unable to determine application identity of the caller?
问题描述
我在VS2010中为Windows Phone编写了一个Silverlight枢纽应用程序。我刚添加了例子代码,从msdn 这里。现在每当我重新加载设计师时,我会收到一个例外:
无法确定主叫方的应用程序身份。
$ b $ System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope范围,键入appEvidenceType)
在System.IO.IsolatedStorage.IsolatedStorageFile.GetStore中的b
(System.IO.IsolatedStorage.IsolatedStorageSettings.get_ApplicationSettings()
在C:中的SettingsSample.AppSettings..ctor()中的(IsolatedStorageScope范围,类型applicationEvidenceType)
< .. \Settings.cs:第34行
这是Visual Studio / Windows Phone SDK中的错误?
这是第34行的构造函数中的代码:
public AppSettings()
{
//获取此应用程序的设置。
try
{
settings = IsolatedStorageSettings.ApplicationSettings;
}
catch(System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
我添加了try-catch来看看是怎么回事我怀疑Visual Studio(调用者)正在尝试运行代码,但没有应用程序(应用程序标识)相关联,因此它失败。可能吗?
任何想法?
您需要添加请查看 DesignerProperties.IsInDesignTool 到该代码,因为在Visual Studio或Expression Blend中访问IsolatedStorageSettings是无效的。
if(!System.ComponentModel.DesignerProperties。 IsInDesignTool)
{
settings = IsolatedStorageSettings.ApplicationSettings;
}
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.
at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type appEvidenceType)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type applicationEvidenceType)
at System.IO.IsolatedStorage.IsolatedStorageSettings.get_ApplicationSettings() at SettingsSample.AppSettings..ctor() in C:..\Settings.cs:line 34
Is this a bug in Visual Studio/Windows Phone SDK?
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);
}
}
I added the try-catch to see what was going on.
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?
Any thoughts?
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屋!