[Mono-bugs] [Bug 65827][Nor] New - BinaryReader.ReadByte() bad behaviour

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 13 Sep 2004 07:30:53 -0400 (EDT)


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 ivanet@gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=65827

--- shadow/65827	2004-09-13 07:30:53.000000000 -0400
+++ shadow/65827.tmp.26921	2004-09-13 07:30:53.000000000 -0400
@@ -0,0 +1,77 @@
+Bug#: 65827
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ivanet@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: BinaryReader.ReadByte() bad behaviour
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+System.IO.BinaryReader.ReadByte() has a radically different behaviour
+compared to Framework.Net.
+
+Framework.Net calls inner stream ReadByte() method.
+Mono does not call inner stream ReadByte() method.
+
+Steps to reproduce the problem:
+1. Compile the code
+
+using System;
+using System.IO;
+
+namespace TestReadByte
+{
+    class Lolo : MemoryStream
+    {
+        public Lolo()
+        {
+        }
+
+        public override int ReadByte()
+        {
+            Console.WriteLine( "Lolo.ReadByte()" );
+            return 23;
+        }
+    }
+
+    class Class1
+    {
+        [STAThread]
+        static void Main(string[] args)
+        {
+            System.IO.BinaryReader br = new System.IO.BinaryReader( new
+Lolo());
+            Console.WriteLine( br.ReadByte().ToString());
+        }
+    }
+}
+
+Actual Results:
+Unhandled Exception: System.IO.EndOfStreamException: Failed to read past
+end of stream.
+in <0x000da> System.IO.BinaryReader:FillBuffer (int)
+in <0x00010> System.IO.BinaryReader:ReadByte ()
+in <0x00054> TestReadByte.Class1:Main (string[]) 
+
+Expected Results:
+Lolo.ReadByte()
+23
+
+
+How often does this happen? 
+Always
+
+Additional Information:
+Framework.Net give expected results