[Mono-bugs] [Bug 38976][Min] Changed - StreamReader.ReadToEnd loops forever

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Mon, 3 Mar 2003 10:21:43 -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 gonzalo@ximian.com.

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

--- shadow/38976	Mon Mar  3 07:51:47 2003
+++ shadow/38976.tmp.17103	Mon Mar  3 10:21:43 2003
@@ -1,14 +1,14 @@
 Bug#: 38976
 Product: Mono/Class Libraries
 Version: unspecified
-OS: 
+OS: unknown
 OS Details: SuSE 8.1 Pro
-Status: NEW   
-Resolution: 
-Severity: 
+Status: RESOLVED   
+Resolution: NOTABUG
+Severity: Unknown
 Priority: Minor
 Component: CORLIB
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: kmpm_se@msn.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -52,6 +52,32 @@
 Additional Information:
 I changed the "while ((len = Read (buffer, 0, size)) != 0)..." in
 StreamReader.cs .ReadToEnd to the line
 "if ((len = Read (buffer, 0, size)) != 0)". Then it worked.
 As long as the code reads from index 0 in "buffer" it always will report a
 length >0 if there is any from the begining.
+
+------- Additional Comments From gonzalo@ximian.com  2003-03-03 10:21 -------
+I tried the following code:
+----
+using System;
+using System.IO;
+using System.Text;
+
+class Test
+{
+	static void Main (string [] args)
+	{
+		MemoryStream ms = new MemoryStream ();
+		ms.Write (Encoding.Default.GetBytes ("That's all folks.\nBye"), 0,
+Encoding.Default.GetByteCount ("That's all folks.\nBye"));
+		ms.Position = 0;
+		StreamReader reader = new StreamReader (ms, Encoding.ASCII, true);
+		Console.WriteLine (reader.ReadToEnd ());
+	}
+}
+-----
+
+and it works fine.
+
+You probably want to set the underlying socket to be non-blocking.
+