Anyone knows the reason of "random" user.config corruption? I've a WinForms app affected by this problem at my client's production line. Found the same issue on the web and a workaround but I can't figure out because it happens.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I'm not sure why it's happening, but you are not alone, dude! I also tried different things to get around this. I wrote my own configuration handling classes with custom serialization. All I can tell you is, it's better but now still there.
One observation I made recently is that the corruption seems to happen when the machine is rebooted (due to Windows Updates for example) while my app is running.
Next thing to try is to catch those shutdown events and try not to write to the config file in this situation.
回答2:
Did you try Properties.Setting.default.reset()
?