Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 884021 - Last Review: April 7, 2006 - Revision: 2.1
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
On This Page
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Â
(http://kbalertz.com/Feedback.aspx?kbNumber=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 "Applies to" section.
MORE INFORMATION
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 ( "The deeply nested XML file is being created.");
File.Delete( "deep.xml" );
StreamWriter streamWriter = File.CreateText( "deep.xml" );
streamWriter.Write("<?xml version='1.0' ?>");
for ( i=1; i<=NODE_DEPTH; i++ )
{
streamWriter.Write( "<N_" + i.ToString() + ">" );
}
for ( i=NODE_DEPTH; i>=1; i-- )
{
streamWriter.Write( "</N_" + i.ToString() + ">" );
}
streamWriter.Close();
XmlDocument doc = new XmlDocument();
doc.PreserveWhitespace = true;
try
{
doc.Load( new XmlTextReader( "deep.xml" ) );
Console.WriteLine( "The deep.xml file has been successfully loaded." );
}
catch ( Exception ex )
{
Console.WriteLine( "The deep.xml file could not be loaded. The exception follows:" );
Console.WriteLine ( ex.Message );
}
Console.WriteLine( "Press ENTER to exit." );
Console.ReadLine();
}
}
}
APPLIES TO
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
| kbtshoot kbfix kbqfe kbhotfixserver KB884021 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please