[Mono-dev] Problem with Mono 3.4.0 and config appSettings on ARM target
Alex J Lennon
ajlennon at dynamicdevices.co.uk
Tue Apr 22 14:08:34 UTC 2014
On 21/04/2014 09:01, Alex J Lennon wrote:
> Hi all,
>
> I've encountered a problem with an application I was running on an ARM
> VFP (i.MX6) target
> under 3.2.8, which now fails under 3.4.0.
>
> The error reported is related to a problem with the configuration file
> and in particular the
> <appSettings> element,
>
> I have reduced it down to a simple test case as follows,
>
> Program.cs (compiled to Program.exe)
>
> namespace DynamicDevices
> {
> public class ConfigTest
> {
> static void Main()
> {
> // NB. Both old deprecated method and new method of obtaining
> configuration values fail
> var v =
> System.Configuration.ConfigurationManager.AppSettings["testkey"];
> // var v =
> System.Configuration.ConfigurationSettings.AppSettings["testkey"];
>
> Console.WriteLine("Config key: " + v);
> }
> }
> }
>
> Program.exe.config
>
> <configuration>
> <appSettings>
> <add key="testkey" value="testval" />
> </appSettings>
> </configuration>
>
> The above runs under 3.2.8 on an x86 target or an ARM VFP target
>
> It also runs under 3.4.0 on an x86 target but when I run on an ARM VFP
> target I get the following
>
> Unhandled Exception:
> System.Configuration.ConfigurationErrorsException: Error Initializing
> the configuration system. --->
> System.Configuration.ConfigurationErrorsException: Unrecognized
> configuration section <appSettings> (/home/root/Program.exe.config line
>
> <snip/> See: http://pastebin.com/GDKTftr4 for the rest
>
> ...
>
> Could anybody advise where I'm going wrong / what I need to look at here?
>
To answer my own question, this was finger trouble on my part.
I was packaging machine.config in the wrong place, and it appears that
without a valid machine.config read in first to populate
<configSections>, the exception will be thrown when Program.exe.config
is read.
More information about the Mono-devel-list
mailing list