Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is my user.config Settings file getting corrupted?

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 ConfigurationErrorsExceptions.

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?

like image 318
RandomEngy Avatar asked Sep 22 '11 02:09

RandomEngy


People also ask

What is user config file?

In computing, configuration files (commonly known simply as config files) are files used to configure the parameters and initial settings for some computer programs. They are used for user applications, server processes and operating system settings.

Where is the user config file?

The path to that file is %appdata%\%publisher_name%\%program_name%\%version%\user. config , e.g. C:\Users\My Name\AppData\Local\My_Company\My_Program.exe\1.0. 0\user. config .

Why config is not opening?

Your computer may be trying to use the wrong program to open the CONFIG file, or it may not have a program installed that can open the file. There are a few different programs you can use to open CONFIG files, including Unknown Apple II File, CRiSP Harvest File, and WatchDirectory Task Information software.


2 Answers

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.

like image 139
Pimenta Avatar answered Oct 31 '22 20:10

Pimenta


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.

like image 26
Garr Godfrey Avatar answered Oct 31 '22 21:10

Garr Godfrey