Microsoft KB Archive/823054

From BetaArchive Wiki

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:

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 "Applies to" section of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Microsoft Visual Studio .NET 2003.
  2. On the File menu, point to New, and then click Project.
  3. In the New Project dialog box, click Visual C# Projects under Project Types, and then click Console Application under Templates.
  4. In the Name text box, replace the default text with MyApplication, and then click OK. By default, Class1.cs is created.
  5. 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("mySection");
                
                // Process all child nodes.
                // Print the "id" attribute, followed by the node type.
                foreach (XmlNode child in node.ChildNodes)
                {
                    try
                    {
                        Console.Write(child.Attributes["id"].Value);
                    }
                    catch
                    {
                        Console.Write("?");
                    }
    
                    Console.Write(" ");
                    Console.WriteLine(child.ToString());
                }
            }
        }
    }
  6. On the Project menu, click Add New Item.
  7. In the Add New Item - MyApplication dialog box, click XML File under Templates.
  8. In the Name text box, replace the default text with App.config, and then click Open.
  9. Replace the code in App.config with the following code:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        
        <configSections>  
            <section name="mySection" type="MyApplication.MyConfigHandler, MyApplication" />
        </configSections>
        
        <mySection>
            <tag id="0" />
        </mySection>
    
    </configuration>
  10. Build the project, and then run the application.


REFERENCES

For additional information about custom configuration sections and handlers, click the following article numbers to view the articles in the Microsoft Knowledge Base:

309045 HOW TO: Create a Custom ASP.NET Configuration Section Handler in Visual C# .NET


318457 HOW TO: Create a Custom ASP.NET Configuration Section Handler in Visual Basic .NET


Keywords: kbbug kbfix kbqfe kbnetframe110sp1fix kbnetframe110presp1fix KB823054