我正在使用下面的代码尝试使用 c# 保存到 Windows Mobile 8 中的本地设置。
public void SaveInfo(string key, string value)
{
if (ApplicationData.Current.LocalSettings.Values.ContainsKey(key))
{
if (ApplicationData.Current.LocalSettings.Values[key].ToString() != null)
{
// do update
ApplicationData.Current.LocalSettings.Values[key] = value;
}
}
else
{
// do create key and save value, first time only.
ApplicationData.Current.LocalSettings.CreateContainer(key, ApplicationDataCreateDisposition.Always);
if (ApplicationData.Current.LocalSettings.Values[key] == null)
{
ApplicationData.Current.LocalSettings.Values[key] = value;
}
}
}
调用代码时,调试崩溃并出现以下异常:
System.Windows.ni.dll 中出现“System.Reflection.TargetInvocationException”类型的未处理异常
任何想法