user.config、.tmp 和 .newcfg 无法保存设置问题

时间:2021-01-31 02:35:43

标签: c# .net wpf app-config desktop-bridge

我有一个在 Microsoft Store 上发布的桌面桥应用(.Net core 3.1 WPF)。我正在使用 Properties.Settings.Default.Save(); 保存用户设置,它适用于 99% 的用户,除了 1% 有一个非常独特的错误:

"Failed to save settings: Unable to save config to file 'C:\Users\theguy\AppData\Local\TheWPFApp\TheWPFApp_Url_z2345l1c0aviaxg4rtylwx2f0u49rdlo\2.1.0.0\user.config'." "   at System.Configuration.ClientSettingsStore.WriteSettings(String sectionName, Boolean isRoaming, IDictionary newSettings)
   at System.Configuration.LocalFileSettingsProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection values)
   at System.Configuration.SettingsBase.SaveCore()
   at System.Configuration.SettingsBase.Save()
   at System.Configuration.ApplicationSettingsBase.Save()
   at TheWPFApp.MainWindow.SaveSettings()"

文件夹中还有一大堆随机的 .newcfg, .tmp 文件,带有 1 user.config(如果通过记事本打开查看是不完整的;只有一些设置写的)。

这些文件的名字好像是随机生成的。 IE。 yfj2fbcv.newcfgyfj2fbcv.tmp

文件似乎也有一个小挂锁图标,但用户权限是“完全控制”。

怀疑用户帐户和所有权是否以某种方式被破坏? IE。 Microsoft 帐户与本地帐户。

如何从 try/catch Exception 块中的代码捕获并修复此问题?

0 个答案:

没有答案
相关问题