About the error "Could not initialize the configuration system"

Asked 2 years ago, Updated 2 years ago, 116 views

The software that was created and introduced about a year ago suddenly recently said, "The configuration system could not be initialized."
Failed to boot with error

While I was investigating, I found an article that said that user.config was damaged.
Does this app have no definition in Properties.Settings.settings and does not create user.config?I feel like it.(I actually looked for it, but I couldn't find it)

The application has only two configurations: xxx.exe and xxx.exe.config.

Basically, the software only runs at the specified time in the task scheduler, so there has been no change in the config file since it was working properly (differential comparison completed)

Is there anything else I should look into other than the cause or Appdata/user/Local... files below?

Creating with VisualStudio 2017C#

Thank you for your cooperation.

c# windows .net

2022-09-30 21:48

3 Answers

Use Process Monitor to find out which processes were working with which files.
The last open file should be the cause, so you may want to check the file name.


2022-09-30 21:48

Cause, Appdata/user/Local....Is there anything else I should look into other than the following files?

C:\Users\[Username]\AppData\Local\[Company Name]\[EXE Name]_Url_[Random Characters]\[Application Version]
I think there is a file named user.config in the folder, so please check if the file is corrupt.
Is it correct as XML?

This file is a user-specific configuration file, so it should work fine even if you delete it.
※ Actually, it depends on the application, so I can't say for sure...

Software created and introduced about a year ago

If you can correct it, it would be good to include a code to delete the user.config file if an exception occurs when loading properties at startup.

The full path to the user.config file is

string fileName=System.Configuration.ConfigurationManager.OpenExeConfiguration(
 System.Configuration.ConfigurationUserLevel.PerUserRoaming).FilePath;

You can find it in the .

You can also extract the definition file that caused the error from the exception information.

catch (System.Configuration.ConfigurationErrorsException exp)
{
   US>string fileName= 
      (exp.InnerException as System.Configuration.ConfigurationException)?.Filename;

I remember having a hard time because the same phenomenon often occurred in the application I created before.


2022-09-30 21:48

Our app has experienced a few similar symptoms this year.

We don't know the cause yet, but if you copy the app with the installation folder (exe, config, etc.) and make it a different folder name, the app will start successfully from within that copied folder.

However, if you change the folder name to the original folder name, a similar error occurs again and you cannot start it.

The app is VS2013 VB.NET and is targeted at .NetFramework 4 Client Profile.
The operating system of the PC is Windows 10 Pro 64 Bit (1809).


2022-09-30 21:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.