Microsoft KB Archive/884021

= FIX: You may experience the System.StackOverflowException error when you open an XML document that contains a deeply nested XML document in the .NET Framework 1.1 and in the .NET Framework 1.0 =

Article ID: 884021

Article Last Modified on 4/7/2006

-

APPLIES TO


 * Microsoft .NET Framework 1.1
 * Microsoft .NET Framework 1.0

-





SYMPTOMS
You may experience the System.StackOverflowException error when you open an XML document that contains a deeply nested XML document. Additionally, your application may fail. This problem may occur in the Microsoft .NET Framework 1.1 and in the .NET Framework 1.0.



CAUSE
You may experience the System.StackOverFlowException error when you use the System.Xml.XmlDocument class to try to open an XML document that contains a deeply nested XML document.



RESOLUTION
To resolve this problem, obtain the latest .NET Framework 1.1 post-Service Pack 1 XML Web services and XML Messaging hotfix rollup package.

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

890673 Availability of the .NET Framework 1.1 post-Service Pack 1 XML Web services and XML Messaging hotfix rollup package 8



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



Steps to reproduce the problem
Run the following code. using System.Xml; using System; using System.IO; using System.Text; using System.Reflection; using System.Xml.XPath; using System.Xml.Xsl;

namespace NestXML {   class Class1 {       static void Main(string[] args) {           const int NODE_DEPTH = 20000; int i;           Console.WriteLine ( &quot;The deeply nested XML file is being created.&quot;); File.Delete( &quot;deep.xml&quot; ); StreamWriter streamWriter = File.CreateText( &quot;deep.xml&quot; ); streamWriter.Write(&quot;&quot;); for ( i=1; i<=NODE_DEPTH; i++ ) {               streamWriter.Write( &quot;&quot; ); }           for ( i=NODE_DEPTH; i>=1; i-- ) {               streamWriter.Write( &quot;&quot; ); }           streamWriter.Close; XmlDocument doc = new XmlDocument; doc.PreserveWhitespace = true; try {               doc.Load( new XmlTextReader( &quot;deep.xml&quot; ) ); Console.WriteLine( &quot;The deep.xml file has been successfully loaded.&quot; ); }           catch ( Exception ex ) {               Console.WriteLine( &quot;The deep.xml file could not be loaded. The exception follows:&quot; ); Console.WriteLine ( ex.Message ); }           Console.WriteLine( &quot;Press ENTER to exit.&quot; ); Console.ReadLine; }   } }

Keywords: kbqfe kbhotfixserver kbtshoot kbfix KB884021

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.