How to ignore a pesky System.Configuration.ConfigurationErrorsException
According to this post on StackOverflow, a ConfigurationErrorsException in a .NET application means that
you put an element in your config that is not recognized and not able to be serialized from the custom configuration class.
While this can indeed be a legitimate error that you need to trap and deal with in your code, I have also encountered it inexplicably arising in an ASP.NET app that otherwise runs as expected.
In other words, I am working on a solution with an ASP.NET web app and a WCF services project that launch separately when debugging so that they can talk to each other. The site builds, deploys, and runs without issue. All my tests pass as expected.
Since moving to Visual Studio 2010 on Windows 7 x64, however, I am suddenly getting ConfigurationErrorsExceptions thrown when running my app w/ the Visual Studio debugger.
The Workaround
If this happens to you and you need a workaround, rest easy; it is possible to tell the Visual Studio debugger to ignore these exceptions.
- Open the Debug menu in Visual Studio and select Exceptions.
- Click Add
- Enter in “System.Configuration.ConfigurationErrorsException” and click Okay
Visual Studio will now ignore those exceptions.