[Mono-bugs] [Bug 79279][Wis] New - System.IO.Ports.SerialPort ReadLine behaviour differs from MS .NET implementation

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Sep 4 14:46:24 EDT 2006


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 matthewp at vulcantech.co.uk.

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

--- shadow/79279	2006-09-04 14:46:24.000000000 -0400
+++ shadow/79279.tmp.1131	2006-09-04 14:46:24.000000000 -0400
@@ -0,0 +1,40 @@
+Bug#: 79279
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: matthewp at vulcantech.co.uk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.IO.Ports.SerialPort ReadLine behaviour differs from MS .NET implementation
+
+System.IO.Ports.SerialPort ReadLine behaviour differs from the MS .NET
+implementation. The MS implementation uses the string represented by the
+NewLine property in order to determine the end of line whereas the Mono
+implementation looks for a fixed \n.
+
+At the moment we're using a simple modification to the current implementation:
+
+			CheckOpen ();
+			List<byte> bytes_read = new List<byte>();
+			byte [] buff = new byte [1];
+
+			if(new_line.Length != 1)
+				throw new NotImplementedException("Only single character NewLine
+strings are supported for reading lines.");
+			
+			while (true){
+				int n = stream.Read (buff, 0, 1);
+				if (n == -1 || buff [0] == new_line[0])
+					break;
+				bytes_read.Add (buff [0]);
+			} 
+			return new String (encoding.GetChars (bytes_read.ToArray ()));


More information about the mono-bugs mailing list