Thanks for making it work; what happens now?

by Michael S. Kaplan, published on 2011/12/26 07:01 -05:00, original URI:

So a question got asked late last year:


My customer reported an issue associated with XmlTextReader.ReadChars. The call to XmlTextReader.ReadChars enters an infinite loop:
       While iRetour = BUFFER_SIZE
           'Infinite Loop After this comment...
           iRetour = myXmlTextReader.ReadChars(buffer, 0, BUFFER_SIZE)
       End While

The problem happens in .NET 2.0.  The same code works fine in .NET 4.0.

Is it a bug? Any input is greatly appreciated.


This was indeed a bug in .NET 2.0, one that was found some time ago.

Unforyunately, the whole red bits/green bits thing came up -- and some of the most important compatibility rules that the BCL (Base Class Libraries) faced were:

In this class the basic determination went like this:

1) The general code pattern was not recommended;

2) Chaining the semantic of ReadChars in the existing red bits was a bad idea.

Of course this leads to a different issue -- now that as of .NET 4.0 the code works, the question that is raised is in wondering what the code does now (in the case that used to fail but which now works).

Do you think this was a good change?

Extra credit for anyone who understand how to repro the failure case in 2.0, and who knows how the change was implemented....

no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day