[Mono-bugs] [Bug 51741][Nor] New - System.IO.BinaryReader.PeekChar( ) modifies the underlying stream
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 4 Dec 2003 17:12:10 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by dev@6wardlaw.freeserve.co.uk.
http://bugzilla.ximian.com/show_bug.cgi?id=51741
--- shadow/51741 2003-12-04 17:12:10.000000000 -0500
+++ shadow/51741.tmp.14847 2003-12-04 17:12:10.000000000 -0500
@@ -0,0 +1,49 @@
+Bug#: 51741
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 8.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dev@6wardlaw.freeserve.co.uk
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.IO.BinaryReader.PeekChar( ) modifies the underlying stream
+
+Description of Problem:
+
+PeekChar( ) on System.IO.BinaryReader modifies the underlying stream.
+
+Essentially, PeekChar( ) calls ReadChar( ) on the underlying stream but
+doesn't reposition the stream before returning. The 'peeked' char is
+placed into a buffer which is used for any subsequent ReadChar( ) call.
+
+This causes two problems.
+
+The first is that the underlying stream is not in the same state as it
+was before the call.
+
+The second is that if the position of the stream is changed after a call
+to PeekChar( ) a call to ReadChar( ) will return the invalid data from
+the PeekChar( ) call.
+
+Steps to reproduce the problem:
+
+Create a test application which uses a BinaryReader and also manipulates
+the underlying stream. ( attached )
+
+How often does this happen?
+
+Everytime.
+
+Additional Information:
+
+The Microsoft .net implementation of this method does not modify the
+underlying stream. If the underlying stream is not seekable then PeekChar
+( ) return -1.