configSection supposed to be at the first element in app.config

128 Views Asked by At

Why is configSection supposed to be at the first element in app.config ?

I had a 'System.TypeInitializationException' in my WPF application,

Message: An unhandled exception of type 'System.TypeInitializationException' occurred in PresentationFramework.dll Additional information: The type initializer for 'System.Windows.Application' threw an exception.

and i followed this suggestion and the error was resolved.

1

There are 1 best solutions below

0
On

As you've found out, and as specified in the documentation (since .net 1.1)

If this element is in a configuration file, it must be the first child element of the element

It's where you specify what configuration sections are going to be in your app.config, hence, it has to be at the start of the configuration element