[Mono-list] Properties.Settings.Default and mono

Matthias Leonhardt mono at mleo.net
Thu May 4 11:22:11 EDT 2006

Hi monodevelopers,

I created a little VS2005 Project (.NET 2.0) and I'm using the new
app.config to preset some Settings.

In the program code I access it the following way:

HostName is a String Setting which is stored correctly in app.config:

<?xml version="1.0" encoding="utf-8" ?>
        <sectionGroup name="userSettings"
type="System.Configuration.UserSettingsGroup, System, Version=,
Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="HostInfoServer.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System,
Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
            <setting name="HostName" serializeAs="String">

If I start the application in windows everything works - if I start it with
mono appname.exe
in linux I get the following error:
Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for HostInfoServer.Program --->
System.TypeInitializationException: An exception was thrown by the type
initializer for HostInfoServer.Properties.Settings --->
System.ArgumentNullException: null key
Parameter name: key
in <0x00182> System.Collections.Hashtable:get_Item (System.Object key)
in <0x00012> System.Configuration.SettingsProviderCollection:get_Item
(System.String name)
in <0x004f6> System.Configuration.ApplicationSettingsBase:get_Properties ()
in <0x00023> System.Configuration.ApplicationSettingsBase:.ctor ()
in <0x0000a> HostInfoServer.Properties.Settings:.ctor ()
in <0x00016> HostInfoServer.Properties.Settings:.cctor ()--- End of
inner exception stack trace ---

in <0x00000> <unknown method>
in <0x00009> HostInfoServer.Program:.cctor ()--- End of inner exception
stack trace ---

This error seems to occure before the first line of my own code is executed.
What's wrong and what can I do to fix this?

thanks for your help!

kind regards,
Matthias Leonhardt, Jena

More information about the Mono-list mailing list