XmlTextReader constructor hangs (only on 1.1 SP1)...

  • Thread starter Thread starter Tom Shelton
  • Start date Start date
T

Tom Shelton

Problem: XmlTextReader Constructor hangs until underlying socket closes
when passed a NetworkStream.

Example:

Dim reader As New XmlTextReader (New NetworkStream(s, False))


I can positively confirm by the way that this only happens AFTER
installation of SP1 for framework 1.1. So, has anyone else have this
issue? I was able to recreate this on 3 different boxes (All windows
XP, 2 with SP2 and 1 without). Everytime, our custom dataprovider hangs
on that line of code. The code is actually in C#, but I don't think
that makes a difference :) What I do know is that this provider has
been working for several months now for several months - pre SP1.

Anyone experience this issue with SP1? Anyone know of a work around?
Other then rewriting our dataprovider :)

This is sort of a big issue, since SP1 is on windows update - and I'm
sure were going to get several customers calling in with this problem
over the next few days. Fortunately, we found that uninstalling the
runtime and reinstalling the old version makes everything work again,
but we would rather find a permanent fix if there is one...
 
The same issue is documented on:
microsoft.public.dotnet.xml
Subject: Reading XML from Stream - Change with .NET 1.1 SP1?

No answers yet.
 
The same issue is documented on:
microsoft.public.dotnet.xml
Subject: Reading XML from Stream - Change with .NET 1.1 SP1?

No answers yet.

Well, it looks like were not the only ones with this problem... For now -
were going to tell our customers NOT to update to SP1. There is just too
much functionality that is broken by this problem.
 
There is a bug with .NET SP 1.1 using XmlTextReader with networkStream.

It works for me:

MemoryStream ms = new MemoryStream();

StreamReader sr = new StreamReader(ns);

if (ns.DataAvailable)
{
char[] b = new char[512];
int nread = sr.Read(b, 0, 512);

ms.Write(System.Text.Encoding.ASCII.GetBytes(b, 0, nread), 0, nread);
ms.Seek(0, System.IO.SeekOrigin.Begin);

XmlTextReader reader = new XmlTextReader(ms);
if (reader.Read())
{
objXmlDocument.Load(reader);
}
}
 
There is a bug with .NET SP 1.1 using XmlTextReader with networkStream.

It works for me:

MemoryStream ms = new MemoryStream();

StreamReader sr = new StreamReader(ns);

if (ns.DataAvailable)
{
char[] b = new char[512];
int nread = sr.Read(b, 0, 512);

ms.Write(System.Text.Encoding.ASCII.GetBytes(b, 0, nread), 0, nread);
ms.Seek(0, System.IO.SeekOrigin.Begin);

XmlTextReader reader = new XmlTextReader(ms);
if (reader.Read())
{
objXmlDocument.Load(reader);
}
}
 
Back
Top