11 February, 2008

Configuration system failed to initialize

Just encountered a problem that’s soooo simple to solve, but yet sooo frustrating when you encounter it.

I was moving some code from my local prototype project up to the official dev environment. At first I forgot some entries in the app.config file. Piece of cake, right?

So off to some cut-n-paste action and I ended up with this:


Looks alright? Well it did to me, so imagine my surprise when I got hit with the following exception:

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

I messed around with it for a while thinking I’d introduced some weird character somewhere or something like that. But no sir, that was not the problem. After googling searching at live.com for a while, I found someone saying that the <configSection> element needs to be the first thing in the config-file.


Perhaps this can save someone else a little time and frustration.