我的 user.config 设置文件如何损坏?
我有一个用户通过调用 Settings.Upgrade()
向我发送了一份崩溃报告:
System.Configuration.ConfigurationErrorsException: Root element is missing.
我让他向我发送了他的 user.config 文件,但该文件全是零。它不知何故已经腐败了。
我找到了一种方法来恢复它,方法是根 据 %localappdata%\MyAppName 目录并删除所有用户配置文件并重新启动应用程序。如果我让应用程序继续执行,它将进一步给出 ConfigurationErrorsException
。
这种腐败可能是我所做的事情造成的吗?我收到了来自数千名用户的多份报告,但我并没有直接弄乱该文件。还有其他人遇到过这个 user.config 损坏吗?
I've had a user send me in a crash report from a call to Settings.Upgrade()
:
System.Configuration.ConfigurationErrorsException: Root element is missing.
I got him to send me his user.config file and the file was all zeroes. It had gotten corrupt somehow.
I found a way to recover from it by rooting around the %localappdata%\MyAppName directory and deleting all user config files and re-launching the app. If I let the app continue execution it would give further ConfigurationErrorsException
s.
Could this corruption be the result of something I've done? I've had multiple reports of it from a base of a few thousand users, but I have not been messing with that file directly. Has anyone else run into this user.config corruption?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是我从这篇文章中得到的一个想法。
您能否检查您的 .Net 框架版本?如果是,您最近是否进行了一些更新,这些更新可能会改变您正在使用的任何方法?
另一个虽然是这篇文章(它有点旧 - 2008 年),但它提供了一些有关如何处理损坏的配置文件的指示。
是否也是由于应用程序无法应对当前用户速率而导致的内存问题?
希望它能有所帮助,因为它还没有发生在我身上,但仍然是一个有趣且令人费解的困境。
Just an idea I got from this article.
Can you check your .Net framework version and if so, did you did some update recently that might have altered any methods that you are using ?
Another though was this article (it's a bit old - 2008) but it gives some pointers on how to handle the corrupted config file.
Can it also be a memory issue caused by the application not being able to cop with the current user rate?
Hope it helps since it has not happened to me yet but still an interesting and puzzling dilemma.
如果运行应用程序的多个实例,设置似乎会损坏。
这似乎是一个计时问题,但一个相对简单的重现方法是让应用程序自行启动然后退出,并尝试在退出时保存设置。
Settings seem to get corrupted if running multiple instances of your application.
It seems to be a timing issue, but a relatively easy way to reproduce is to have the application launch itself and then quit, and try to save settings on exit.