The dreaded “Configuration system failed to initialize”

So has this ever Happened to you (if not then you’re lucky…) :


System.Configuration.ConfigurationErrorsException was unhandled Message=”Configuration
system failed to initialize”

BareMessage=”Configuration system failed to

I’ve discovered that the worst VS Error response is the one where the message has nothing to do with the actual error!!!
And I will walk throught debugging this problem with you. Sure there are many references
out there saying make sure your <configSections /> block is the first thing inside your empty *.config

Like this Not Like this

<?xmlversion=1.0encoding=utf-8 ?>



    <appSettings />


<?xmlversion=1.0encoding=utf-8 ?>


     <appSettings />





Well that was o.k. now what do You or I do if your still
getting the wonderfully descriptive, “Configuration system failed to initialize”?

Well, I spent more hours consulting
The Google
and… after hunting down that link… I found something, the
file wasn’t getting copied to the correct file with the
build, so I went into Properties->Copy Always.. and still Nothing…. So I’m looking at the Build as I try
some things and I see a few build warnings.. I cleaned
those up.. and wait for it…

I learned that if you have :

<?xmlversion=1.0encoding=utf-8 ?>








The Config Reader will only see
“bobo” as a dog…
But that doesn’t really help me… And so I continued my quest into the
neathers of C# config sections… I was hopefull about a post concerning
renaming.. only to see that I haven’t changed the name… so no dice there. I opened up my application.exe.config
file and noticed that it was an old version so I deleted it and rebuilt.. still
nothing…(the rebuilt one was the same as the old one.. ) Ahh HA… now to just figure
out how this happens.. o.k. it’s time to go to sleep I made “progress”.

Ultimatly I solved this problem by starting a new solution and importing all the
files into this solution, and discarding the old one. In the end I believe it
boils down to an out of synch issue in my subversion. (Ank svn).

I hope this helps you.

About Larry Louisiana

I'm a Microsoft Partner Consultant.
This entry was posted in Programming and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s