[Mono-bugs] [Bug 79022][Blo] New - StreamWriter aborts writing with the regular end of program

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Aug 6 21:32:14 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 gampps at gmx.de.

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

--- shadow/79022	2006-08-06 21:32:14.000000000 -0400
+++ shadow/79022.tmp.787	2006-08-06 21:32:14.000000000 -0400
@@ -0,0 +1,105 @@
+Bug#: 79022
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.8.0.5) Gecko/20060731 Ubuntu/dapper-security Firefox/1.5.0.5 // Mono 1.1.13.6 // MonoDevelop 0.10
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: io-layer
+AssignedTo: dick at ximian.com                            
+ReportedBy: gampps at gmx.de               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: StreamWriter aborts writing with the regular end of program
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+The System.IO.Streamwriter WriteLine()  Procedure seems to abort every time
+when I try to write. I think the programm ends after computing and takes
+the StreamWriter with it, regardless of the unfinished stream.
+
+See the Code Sample I used (at the end). The Program reads a file per Line,
+adds something to the beginning and writes it back to another file.
+
+The clue is: The generated output with System.Console.WriteLine() (for
+review purposes only) generates the _correct_ and _full_ output.
+
+The System.IO.Streamwriter WriteLine() does not stop at exactly the same
+point every time it's more like an area.
+
+
+Steps to reproduce the problem:
+1. Compile the source code below
+2. Run the Program
+3. Wonder
+
+******************************** Source **********************************
+
+
+// project created on 08/07/2006 at 03:15
+
+/*
+
+This Project is only for one purpose:
+To rescue my exported, (wrong)reformatted Playlist from iTunes
+
+It reads my incorrect playlist, adds the missing parts of the path
+and writes a new file
+
+*/
+using System;
+
+namespace PerLine
+{
+	class MainClass
+	{
+		public static void Main(string[] args)
+		{
+
+			//ObjectList saves everything in a linked List
+			//Because I was too lazy to change the List c'tor
+			//I construct the first one 'null', so the first item
+			//is null
+			ObjectList.Liste zeilen = new ObjectList.Liste(null);
+			
+			//As easy as it can be...
+			System.IO.StreamReader reader = new
+System.IO.StreamReader("/home/afisch/mlieb.m3u", System.Text.Encoding.UTF8);
+			System.IO.StreamWriter writer = new
+System.IO.StreamWriter("/home/afisch/lieblinge.m3u");
+			
+			//not really byzantine
+			for(string zeile = reader.ReadLine(); zeile != null; zeile =
+reader.ReadLine())
+			{
+				zeilen.AddNode(zeile);
+			}
+			
+			
+			//Okay, First one is 'null', so we have to add 1 to 'i'
+			//But the last element + 1 is very unexplored space, so
+			//Count-1 looks fine, except you like exploring undiscoverd worlds
+			for(int i = 0; i < zeilen.Count-1; i++)
+			{
+				
+				zeilen.GoTo(i+1);
+				
+				//Now we add the missing part to _every_ line
+				zeilen.CurrentNode.Value = "/Musik" +
+(zeilen.CurrentNode.Value).ToString();
+				
+				//The whole bunch of files is shown correctly in the console
+				System.Console.WriteLine((zeilen.CurrentNode.Value).ToString());
+				
+				//The writer knocks off after he wrote most of the file
+				writer.WriteLine((zeilen.CurrentNode.Value).ToString());
+			}
+		}
+	}
+}


More information about the mono-bugs mailing list