I am using the Configuration Section Designer for .NET to build a simple ConfigurationElementCollection
. It appears that everything builds just fine and the code is automatically generated since the sub-elements are visible with Intellisense.
Unfortunately, even though I have added elements to the collection in the configuration section, they do not exist at run-time; it shows the collection's Length
property to be 0 - i.e. the collection is empty even though, as you can see in my example XML, I have clearly put them there:
Example configuration
<logParserSettings xmlns="LogParser">
<domainControllers>
<domainController ID="0" name="Local" serverType="Local" enabled="true"/>
<domainController ID="1" name="DC1" serverType="WindowsServer2003" enabled="false" />
<domainController ID="2" name="DC2" serverType="WindowsServer2008" enabled="false" />
</domainControllers>
</logParserSettings>
Miscellaneous
- In the designer, all I have is what you see here, a
ConfigurationSection
, aConfigurationElementCollection
, and aConfigurationElement
- there are no additional configuration elements/sections/groups - I am not adding or removing anything at run-time
- I have tried both generating and not generating the
Singleton
property, but neither the singleton instance nor an instance of the settings class seem to work - For the ID attribute, the
Is Key
property is set to true, and all other attributes are marked true forIs Required
Has anyone ever run into this? If so, what change do I have to make to get this to work as intended?