Microsoft KB Archive/823054

= System.Configuration.ConfigXmlWhitespace Nodes Are Added in the Custom Sections of the App.config File =

Article ID: 823054

Article Last Modified on 10/5/2005

-

APPLIES TO


 * Microsoft .NET Framework 1.1

-



SYMPTOMS
If you define a custom configuration handler, and then you use the ConfigurationSettings.GetConfig method to load a custom section from the configuration file of a Microsoft .NET Framework-based application, the resulting XmlNode may contain child nodes of type System.Configuration.ConfigXmlWhitespace for each white space that occurs in the custom section.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework 1.1 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.   Date         Time   Version       Size       File name --  17-Sep-2003  22:18  1.1.4322.947    258,048  Aspnet_isapi.dll 17-Sep-2003 22:18  1.1.4322.947     20,480  Aspnet_regiis.exe 17-Sep-2003 22:18  1.1.4322.947     32,768  Aspnet_state.exe 17-Sep-2003 22:18  1.1.4322.947     32,768  Aspnet_wp.exe 15-May-2003 18:49                   33,522  InstallPersistSqlState.sql 15-May-2003 18:49                   34,150  InstallSqlState.sql 17-Sep-2003 22:09  1.1.4322.947     94,208  PerfCounter.dll 18-Sep-2003 19:43  1.1.4322.947  1,216,512  System.dll 18-Sep-2003 19:40  1.1.4322.947    323,584  System.Runtime.Remoting.dll 18-Sep-2003 19:43  1.1.4322.947  1,253,376  System.Web.dll 18-Sep-2003 19:42  1.1.4322.947    819,200  System.Web.Mobile.dll 18-Sep-2003 19:41  1.1.4322.947    569,344  System.Web.Services.dll 18-Sep-2003 19:44  1.1.4322.947  1,335,296  System.XML.dll 17-Sep-2003 22:13                   14,472  WebUIValidation.js



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article.



Steps to Reproduce the Behavior
 Start Microsoft Visual Studio .NET 2003. On the File menu, point to New, and then click Project. In the New Project dialog box, click Visual C# Projects under Project Types, and then click Console Application under Templates. In the Name text box, replace the default text with MyApplication, and then click OK. By default, Class1.cs is created.  Replace the code in Class1.cs with the following code: using System; using System.Xml; using System.Configuration;

namespace MyApplication {   public class MyConfigHandler : IConfigurationSectionHandler {       public MyConfigHandler {       }        public object Create(object parent, object configContext, XmlNode section) {                      return section; }   }

class MyClass {       [STAThread] static void Main(string[] args) {           // Get an XmlNode that refers to the custom configuration section. XmlNode node = (XmlNode) ConfigurationSettings.GetConfig(&quot;mySection&quot;); // Process all child nodes. // Print the &quot;id&quot; attribute, followed by the node type. foreach (XmlNode child in node.ChildNodes) {               try {                   Console.Write(child.Attributes[&quot;id&quot;].Value); }               catch {                   Console.Write(&quot;?&quot;); }

Console.Write(&quot; &quot;); Console.WriteLine(child.ToString); }       }    } }  On the Project menu, click Add New Item.</li> In the Add New Item - MyApplication dialog box, click XML File under Templates.</li> In the Name text box, replace the default text with App.config, and then click Open.</li>  Replace the code in App.config with the following code: <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configSections> <section name=&quot;mySection&quot; type=&quot;MyApplication.MyConfigHandler, MyApplication&quot; /> </configSections> <mySection> <tag id=&quot;0&quot; /> </mySection>

</li> Build the project, and then run the application.</li></ol>

<div class="references_section">