parsing issue at save time

Topics: General discussion
Oct 10, 2007 at 4:32 PM

I have an issue when trying to save a .config xml file in the EntLibConfig.exe tool. My .config file is generated with another tool and all XML tags have an opening and a closing tag. The following tag is causing an error on the "add" element when saving the file:
<add name="RsaProtectedConfigurationProvider" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" keyContainerName="test" useMachineContainer="true">

If i replace <clear></clear> with <clear /> it works just fine. Any idea about this issue? Thanks!
Oct 11, 2007 at 1:10 PM

It's really the System.Configuration assembly that parses the configuration file, so there is little that can be done about this.

If you try editing this config file with the standard VS editor you will get a warning stating that the <clear> element cannot have white space, and if you read the configuration the connection strings will be empty.

<?xml version="1.0" encoding="utf-8" ?>
<add name="foo" connectionString="bar"/>
<add name="foo2" connectionString="bar"/>

static void Main(string[] args)
Debug.Assert(ConfigurationManager.ConnectionStrings.Count == 2, "should have 2 connection strings");