[Mono-dev] MS/Mono incompatibility in StreamReader.ReadLine()

Mike Glenn mglenn at zoominternet.net
Fri Feb 17 10:43:05 EST 2006


I think my original message may have gotten lost in all the other talk on the
list.

The attached patch makes StreamReader.ReadLine() behave like the MS.Net 1.1
implementation( not sure if 2.0 is the same, but I suspect it is ). See message
below for a description of the incompatibility.

Please let me know if it could be applied or if it needs work...

-----Original Message-----
To: mono-devel-list at lists.ximian.com
Subject: [Mono-dev] StreamReader ReadLine Issue

Hello all,

I've run into an issue with StreamReader.ReadLine() and differences in MS.Net
implementation. Here's the basics of it:

While reading messages from a pop server I encountered a message that had some
improper rfc822 formatting that looked like this (using escapes to show the 
data stream as it was past to me):

From: someone at somewhere.com\r\n
Subject: Something that you don't care about\r\r\n
X-SomeHeader: blah blah blah\r\n
\r\n
some message body\r
some more\r\n
\r\n
.\r\n

If you note on the subject line there are 2 carriage returns followed by a 
newline. Mono returns the subject line on the first call to ReadLine() and 
on the next call returns an empty String. The MS implementation returns the 
subject line and on the following call returns the X-Header line and not an 
empty line. 

The attached patch, against mcs, changes how StreamReader's FindNextEOL() 
method functions, which allows ReadLine() to behave the same way as the 
MS.Net implementation.

Mike Glenn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StreamReader_EOL.patch
Type: application/octet-stream
Size: 1452 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060217/2ac9ac04/attachment.obj 


More information about the Mono-devel-list mailing list