Welcome to CrankyGoblin.Com Sign in | Join | Help

Public Class GeoffAppleby

Inherits Microsoft.VisualBasic.MVP : Implements IBrainFart
"Configuration system failed to initialize"

Of you people who have upgraded to the 2.0 framework (or played with it in anger at least) how many of you have seen this error message?

Configuration system failed to initialize.

This has to be the exception that annoys me the most in everything that's changed in 2.0. In 1.1 the most useless exception message was when something went wrong with the XMLSerializer - just some strange error about being unable to load some random dll in some some temp folder.

New in 2.0 is the ConfigurationManager. A new wrapper class that deals with all things {app|web}.config. And the ConfigurationManager is female, so far as I can tell - if things aren't exactly right, then all hell breaks loose, but you have to put in a lot of work to find out exactly what's wrong.

A lot people have had trouble with this over the last few months already, but we got hit with a shocker, simply by forgetting to check one tiny little thing.

Back in the 1.1 framework, all our settings would go in the appSettings node of the app.config. To make it easy (since it was the only thing the developers would touch time and again) we'd put it right at the top, as the first child of the configuration node:

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

    <appSettings>

        <add key="foobar" value="fnord" />

    </appSettings>

...

In 2.0 (in VB) we've now got access to My.Settings. We were in a rush this week, and so rather than work out what our standards should be for using My.Settings, we stuck with just dumping in an appSettings node like we're used to. So as per custom, I stuck it in at the top of the file.

And from that moment on, we could not access any of our settings. If I took it out, our test settings (using My.Settings) would work. Add it in, and neither the appSettings nor My.Settings would work - we'd only get the above error message.

There were two of us working on the project, and I was busy with a few different things at once. After a long while, the other guy found a fix (while I was working on something else) - if the appSettings node was moved lower in the file, then everything came good again.

The next day I had a chance to research what was really going on. Sure, the other guy found a fix, but never actually located the actual problem. It took me five minutes :) If you ever get an exception, and it doesn't tell you enough information, there are sometimes more places to look. All exceptions have an InnerException property - more often than not this value is null, but it isn't, it can be quite useful - in this situation, it was more than enough to identify what's going on.

Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element. (C:\path\to\configfile\WindowsApplication1.exe.config line 6)

Ah ha! So simple once you know. If you ask me however, it's a bloody stupid rule. Why should order matter?

Sometimes these problems are easily solved - sometimes it's not so easy. But my advice is simple: make sure you check _all_ the information available - it might make things a lot easier in the long run.

Posted: Wednesday, March 01, 2006 3:24 AM by Geoff Appleby
Filed under: ,

Comments

Jason Haley said:

# March 2, 2006 5:23 AM

Jon said:

You Rock.. I had the same problem - Configuration system failed to initialize.
Thanks for the insight
# April 3, 2006 8:27 PM

Morgan said:

Same as other poster... Thanks for the tip! I was already down to my last 2 handfulls of hair to pull out.

# October 27, 2006 8:48 AM

LeVaN said:

http://www.usikker-sekretaer-prostituert.toyt3.com ^^^ http://www.tullete-student-dritt.toyt3.com ^^^ http://www.sentimentale-giovane-gruppo.str0nz0.com ^^^ http://www.desiderare-fighetta-merda.str0nz0.com ^^^ http://www.clip-pollon-travesti.100milfotos.com ^^^ http://www.gals-mamacitas-7.100milfotos.com ^^^ http://www.porn-suora-reggicalze.allievo69.com ^^^ http://www.bramare-bionde-gruppo.allievo69.com ^^^ http://www.webchat-gay-sex.huor4.com ^^^ http://www.itsetietoinen-lehmitytto.huor4.com ^^^ http://www.tunne-beibit-virtsa.hu0ra.com ^^^ http://www.jumalallinen-opiskelija-tupla-penetraatio.hu0ra.com ^^^ http://www.comfortable-fighetta-doppio-penetrazione.fott1.com ^^^ http://www.piu-caldo-vergognoso-vergine.fott1.com ^^^ http://www.beautiful-cameriera-figa-fotti.f0tti.com ^^^ http://www.comico-operaio-amore.f0tti.com ^^^ http://www.galeria-videl-hentai.asiaticas-putas.com ^^^ http://www.avi-doa-tetaza.asiaticas-putas.com ^^^ http://www.piss-blowfish.sexknulla.com ^^^ http://www.valkomsdrinkar-remsa.sexknulla.com ^^^ http://www.eiaculazioni-di-culo.corneo69.com ^^^ http://www.ritirarsi-giovane-scopata.corneo69.com ^^^ http://www.orgia-enanos-desnudos.dibujitosporn.com ^^^ http://www.garotas-brasileras.dibujitosporn.com ^^^ http://www.ludicrous-fighette-diteggiatura.disponibile69.com ^^^ http://www.bello-femmina-azione.disponibile69.com ^^^ http://www.jpg-scolarette-troie.gayfrei.com ^^^ http://www.movies-tranxesuales-gratis.gayfrei.com ^^^ http://www.videos-fotolog-erotico.petarda2fotos.com ^^^ http://www.toy-us.petarda2fotos.com ^^^ http://www.voyeur-23-cuadros.lesbianavideo.com ^^^ http://www.free-tranny-photo.lesbianavideo.com ^^^ http://www.culos-nenas.pollonesamateur.com ^^^ http://www.wwwpijas-clip.pollonesamateur.com ^^^ http://www.pic-fotos-himem.sexoexnovia.com ^^^ http://www.xnxxcom-galerias.sexoexnovia.com ^^^ http://www.foto-porno-casero.latinas-putas.com ^^^ http://www.foto-brasileras-tetonas.latinas-putas.com ^^^ http://www.videos-eroticos-argentinos.putasmorochas.com ^^^ http://www.debajo-las-faldas.putasmorochas.com ^^^

# November 28, 2006 12:32 AM

Happy said:

Awesome article!  I was at a loss until I came across it.

# July 14, 2007 3:14 AM

jeremy brown said:

Precisely solved my problem, identifying both the root cause. I discovered simultaneously that the CLR debugger will let you examine the exception inner exception.

Brilliant.

# September 6, 2007 2:15 AM

Gayatri and Deepika said:

This really works - we were stuck while trying to set up a config file for our SSIS package and had no clue where this error came from. Reordering the XML in config helped made it work in a flash.

# January 18, 2008 4:50 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

To submit your comment, click on these pictures:
  • Geoff's dad's tongue
  • Hairy Geoff
  • Super Geoff!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Can't recognise the people in these pictures? Look here for a quick introduction.
There's a time limit for you to get your comment submitted before this set of pictures expires. If you think it's been longer than 10 minutes, get some new pictures first (you won't lose what you've typed so far).
Get some new pictures 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS