Actually it is locking up on the firs call to ReadOuterXml when when
two or mowe MITest elements exists in the xml file.
TJO - 30 Aug 2005 03:25 GMT
I was using the SystemInternal FileMon program to watch the XML file as
my program ran and noticed a buffer overflow entry:
7:22:10 PM TestClassTester:1424 QUERY
INFORMATION C:\STProjects\Projects\SmartMI\TestClassTester\bin\Debug\NothingTestLog_Foo.xml BUFFER
OVERFLOW FileFsVolumeInformation
> reader = new XmlTextReader(fs);
>
[quoted text clipped - 6 lines]
> stringBuilder.Append(reader.ReadOuterXml()); // locks up here
> when reading the second MITest element
Well, it works for me, but I see the problem here. Beware that after
reader.ReadOuterXml() call the reader is positioned at the next node
*after* </MITest>. If it's whitespace - it works, if that's next
<MITest> start tag - you loses it by calling reader.Read() in while
statement. In such cases the loop better be implemented using
!reader.EOF as invariant:
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element &&
reader.Name.Equals("MITest"))
{
Console.WriteLine(reader.ReadOuterXml());
}
else
{
reader.Read();
}
}

Signature
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net
http://blog.tkachenko.com
TJO - 30 Aug 2005 15:06 GMT
Thanks Oleg,
I suspected it was something like this but my sample still fails after
modifying my code to look like yours.
The failure still fails on the second time the reader.ReadOutXml() line
is reached in the loop. The strange thing is that it is not really a
failure as in the program crashes. It just hangs there.
So I remain stuck :(