473,395 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Working app suddenly breaking. Changes to System.Xml.dll?

Hi all.

Recent Windows updates seem to have broken our application. It used to
run fine but now fails with XmlExceptions when loading a document.
We've narrowed the problem to the following:

We create an XmlTextReader by passing an instance of our own subclass of
FileStream. Our subclass is called "ObfuscatingFileStream," and it
overrides the Read and Write methods by shifting bits to discourage our
users from hand-editing our documents. Here are the methods:

//------------------------------------------------------------

public override int Read(byte[] array, int offset, int count){
int bytesRead = base.Read(array, offset, count);
for(int i = 0; i < count; i++){
byte b = array[i];
array[i] = (byte)((b&128)/128 + (b << 1));
}
return bytesRead;
}

public override void Write(byte[] array,int offset,int count){
for(int i = 0; i < count; i++){
byte b = array[i];
array[i] = (byte)(128*(b&1) + (b >> 1));
}
base.Write(array, offset, count);
}
//------------------------------------------------------------

This code worked fine until very recently, when users started to
complain that they could no longer open documents in our app. They get
random XmlExceptions. Uninstalling the .NET Framework and reinstalling
from the .NET developer 1.1 redistributable always fixes the problem...
temporarily. Then in a few days it's broken again. I suspect Windows
Update.

So my supervisor has discovered that replacing "count" in the for loop
of the read method with "bytesRead" fixes our problem.

But why? What recent change has been made to .NET's XML readers that
suddenly makes the *unused* portion of the buffer significant? Why on
earth should it matter whether we change bytes after array[bytesRead]?

Thanks for any help,

Andrew
Nov 12 '05 #1
3 1685
This is a problem that was introduced by a bug fix made between version 1.1
and SP1. Affected customers can contact PSS and request a QFE if this
problem severely affects their business cases.

"Andrew Vardeman" <an*****@iastate.edu> wrote in message
news:e0**************@TK2MSFTNGP10.phx.gbl...
Hi all.

Recent Windows updates seem to have broken our application. It used to
run fine but now fails with XmlExceptions when loading a document.
We've narrowed the problem to the following:

We create an XmlTextReader by passing an instance of our own subclass of
FileStream. Our subclass is called "ObfuscatingFileStream," and it
overrides the Read and Write methods by shifting bits to discourage our
users from hand-editing our documents. Here are the methods:

//------------------------------------------------------------

public override int Read(byte[] array, int offset, int count){
int bytesRead = base.Read(array, offset, count);
for(int i = 0; i < count; i++){
byte b = array[i];
array[i] = (byte)((b&128)/128 + (b << 1));
}
return bytesRead;
}

public override void Write(byte[] array,int offset,int count){
for(int i = 0; i < count; i++){
byte b = array[i];
array[i] = (byte)(128*(b&1) + (b >> 1));
}
base.Write(array, offset, count);
}
//------------------------------------------------------------

This code worked fine until very recently, when users started to
complain that they could no longer open documents in our app. They get
random XmlExceptions. Uninstalling the .NET Framework and reinstalling
from the .NET developer 1.1 redistributable always fixes the problem...
temporarily. Then in a few days it's broken again. I suspect Windows
Update.

So my supervisor has discovered that replacing "count" in the for loop
of the read method with "bytesRead" fixes our problem.

But why? What recent change has been made to .NET's XML readers that
suddenly makes the *unused* portion of the buffer significant? Why on
earth should it matter whether we change bytes after array[bytesRead]?

Thanks for any help,

Andrew

Nov 12 '05 #2
Thanks for the reply. Fortunately, this program was used for data
collection last year and is now only being used by a few people locally
whose installations we can easily replace with a recompiled version.
I'm interested to know, though, whether my code is "incorrect" or just
"unexpected." Whose code is broken, Microsoft's or mine? Will MS "fix"
the issue in a future .NET release? If not, a warning in the
documentation not to fill bytes past bytesRead would be helpful.

Thanks again,

Andrew

Zafar Abbas [MSFT] wrote:
This is a problem that was introduced by a bug fix made between version 1.1
and SP1. Affected customers can contact PSS and request a QFE if this
problem severely affects their business cases.

"Andrew Vardeman" <an*****@iastate.edu> wrote in message
news:e0**************@TK2MSFTNGP10.phx.gbl...
Hi all.

Recent Windows updates seem to have broken our application. It used to
run fine but now fails with XmlExceptions when loading a document.
We've narrowed the problem to the following:

We create an XmlTextReader by passing an instance of our own subclass of
FileStream. Our subclass is called "ObfuscatingFileStream," and it
overrides the Read and Write methods by shifting bits to discourage our
users from hand-editing our documents. Here are the methods:

//------------------------------------------------------------

public override int Read(byte[] array, int offset, int count){
int bytesRead = base.Read(array, offset, count);
for(int i = 0; i < count; i++){
byte b = array[i];
array[i] = (byte)((b&128)/128 + (b << 1));
}
return bytesRead;
}

public override void Write(byte[] array,int offset,int count){
for(int i = 0; i < count; i++){
byte b = array[i];
array[i] = (byte)(128*(b&1) + (b >> 1));
}
base.Write(array, offset, count);
}
//------------------------------------------------------------

This code worked fine until very recently, when users started to
complain that they could no longer open documents in our app. They get
random XmlExceptions. Uninstalling the .NET Framework and reinstalling
from the .NET developer 1.1 redistributable always fixes the problem...
temporarily. Then in a few days it's broken again. I suspect Windows
Update.

So my supervisor has discovered that replacing "count" in the for loop
of the read method with "bytesRead" fixes our problem.

But why? What recent change has been made to .NET's XML readers that
suddenly makes the *unused* portion of the buffer significant? Why on
earth should it matter whether we change bytes after array[bytesRead]?

Thanks for any help,

Andrew


Nov 12 '05 #3
CLL
Hi Zafar -

Would it be possible for you to post the KB article number for this QFE so
that we can request it?

"Zafar Abbas [MSFT]" wrote:
This is a problem that was introduced by a bug fix made between version 1.1
and SP1. Affected customers can contact PSS and request a QFE if this
problem severely affects their business cases.

"Andrew Vardeman" <an*****@iastate.edu> wrote in message
news:e0**************@TK2MSFTNGP10.phx.gbl...
Hi all.

Recent Windows updates seem to have broken our application. It used to
run fine but now fails with XmlExceptions when loading a document.
We've narrowed the problem to the following:

We create an XmlTextReader by passing an instance of our own subclass of
FileStream. Our subclass is called "ObfuscatingFileStream," and it
overrides the Read and Write methods by shifting bits to discourage our
users from hand-editing our documents. Here are the methods:

//------------------------------------------------------------

public override int Read(byte[] array, int offset, int count){
int bytesRead = base.Read(array, offset, count);
for(int i = 0; i < count; i++){
byte b = array[i];
array[i] = (byte)((b&128)/128 + (b << 1));
}
return bytesRead;
}

public override void Write(byte[] array,int offset,int count){
for(int i = 0; i < count; i++){
byte b = array[i];
array[i] = (byte)(128*(b&1) + (b >> 1));
}
base.Write(array, offset, count);
}
//------------------------------------------------------------

This code worked fine until very recently, when users started to
complain that they could no longer open documents in our app. They get
random XmlExceptions. Uninstalling the .NET Framework and reinstalling
from the .NET developer 1.1 redistributable always fixes the problem...
temporarily. Then in a few days it's broken again. I suspect Windows
Update.

So my supervisor has discovered that replacing "count" in the for loop
of the read method with "bytesRead" fixes our problem.

But why? What recent change has been made to .NET's XML readers that
suddenly makes the *unused* portion of the buffer significant? Why on
earth should it matter whether we change bytes after array[bytesRead]?

Thanks for any help,

Andrew


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Norman Swartz | last post by:
OS system is Windows XP Pro SP2. The following works perfectly in IE but not at all in Netscape: <tr> <td valign="middle" background="dull.gif" onMouseOver="this.background='bright.gif';"...
1
by: Don | last post by:
I'm having problems with intellisense, autocomplete, etc. suddenly not working in certain classes of a project I'm working on. All the options are set, and it all works fine for most classes, but...
4
by: John Wood | last post by:
I saw that Microsoft have released a list of breaking changes in .Net here: http://msdn.microsoft.com/netframework/programming/breakingchanges/runtime/default.aspx While this is useful, it seems...
12
by: Mike Gaab | last post by:
Hi, A newcomer to .Net (I've held out as long as I can.). I am using VS.Net 2003. I am writing some web apps and I am confronted with the usual issues that one faces when coming from a Windows,...
2
by: Trevor | last post by:
Argh! This problem is driving me nuts! Can you help? In November of 2003, I installed a web service on Windows Server 2003 built in VB.NET for v1.1.4322 of the framework. It contains a timer...
2
latitude
by: latitude | last post by:
Have had a few questions here but no replies so far so thought id give it one more go: Im working on a textviewer/editor and have used autodetect url on it, and it has worked fine. But somewhere...
1
by: rickcasey | last post by:
I wonder if anyone has experienced something like this, as it seems truly bizarre and is causing me to tear out my hair (what little there is left of it).... The exec() function just suddenly...
2
by: Steve | last post by:
I have a new database created in Access 2007. Things were going swimmingly (or as well as they do for an amateur like me) when suddenly calculated fields on a form started giving me "?Name# as...
1
by: Leon Mayne | last post by:
Hello, I have a gridview that's bound to a generic list of business objects and am using the RowCommand event to capture user clicks on actions. This was working fine up until today, but now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.