This morning I spend some time tracking down a ConfigurationErrorsException in an application I am working on. The application ran just fine if I started it but when running unit tests I would receive a ConfigurationErrorsException. Kind of weird as these test ran fine last week. Turns out there was a change in the application settings that where user scoped. And as these settings are stored under the current user they ended up in a somewhat hidden location, in my case “C:\Documents and Settings\Maurice\Local Settings\Application Data\Mutant_Design__support@te”. Now the Mutant_Design__support@te part seems to be part of the excellent TestDriven.Net I was using to run the test. So after I deleted all subdirectories there the test ran just fine again.
This kind of ConfigurationErrorsException error is a bit hard to track down so keep this one in mind as a possible cause and remember that a test framework might use a different directory to store settings then a normal run does.