Fixing Settings and Configuration Errors in .NET

Fixing Settings and Configuration Errors in .NET

Sometimes, adding default settings will result in your program throwing a generic error in the app.config file. The MSDN reference page for the error says something like, “This is a generic error thrown when something goes wrong.” Wonderful?it’s completely accurate and totally useless. No surprise there…

Well maybe now there is some hope: here’s how to fix at least one of these settings problems. There may be a couple of different outer messages that mask it, but this error is always thrown on a Property Get block for one of your settings, and the inner error is always a failure to initiate.

What has actually happened is that the format of the saved settings does not match the format the program currently expects, so it cannot read them. You need to get rid of the old settings. The problem is that they’re tricky to find. They are not anywhere near your development environment. You will find them hiding in a special folder that holds settings for most Windows programs. It should be something like:

C:Documents and Settings*yourname*Local SettingsApplication Data*yourproject**yourprojectid*(*yourversionnumber* 

Inside the final folder, hidden like a diamond in a coalmine, is the culprit, a file called simply user-config.

Now that you found the user-config file, it is time to surgically remove it.


It may not be the problem, and it would be a shame to throw away your data for no reason. It would be even more of a shame if you were accidentally looking at the wrong user-config file. Instead, rename it so that VB cannot see it. I usually put an “x” in front of the current name. Don’t worry. The default values you entered into settings are stored elsewhere and will remain intact.

Now retest your project. Hopefully, now you are up and running again. If this file was the problem, the project should now run normally.

When you look back into this folder, you will see that a new user-config file has been created. You will, however, have lost any changes you made to the program while you were testing. Should you need to remind yourself what these changes were, the old file (the one that you cunningly did not delete) is readable by NotePad, and once you get past the long data names and strange routines, you can pretty much guess what is going on.

Here are some things to remember:

  • Surprisingly, once the program runs successfully, hiding the new file and putting the old, corrupt one back does not recreate the problem. I have no idea why.
  • The mid-level folders are hidden/read-only so make sure Windows Explorer is set to be able to display them as you drill down.
  • *yourprojectid* looks like gibberish. It starts with *yourproject*, then .vshost.exe followed by a bunch of weird characters.
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes