[Mono-bugs] [Bug 52094][Wis] New - Console.Out.Close() actually closes its TextWriter

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 28 Apr 2004 20:11:49 -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 miguel@ximian.com.

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

--- shadow/52094	2004-04-28 20:11:49.000000000 -0400
+++ shadow/52094.tmp.14341	2004-04-28 20:11:49.000000000 -0400
@@ -0,0 +1,65 @@
+Bug#: 52094
+Product: Mono: Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: RESOLVED   
+Resolution: FIXED
+Severity: Unknown
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ginga@kit.hi-ho.ne.jp               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Console.Out.Close() actually closes its TextWriter
+
+Mono's System.Console.Out.Close() actually closes the text writer, while 
+MS.NET (1.1) does not.
+
+Steps to reproduce the problem:
+
+Console.Out.Close ();
+Console.Write ("TEST");
+
+This causes ObjectDisposedException under Mono.
+
+How often does this happen? 
+- Always.
+
+Additional Information:
+
+I tried below, and found that under MS.NET Console.Out and generally 
+synchronized TextWriter are of the same class.
+
+----
+StringWriter sw = new StringWriter ();
+TextWriter tw = TextWriter.Synchronized (sw);
+Console.WriteLine (tw.GetType ());
+
+Console.WriteLine (Console.Out.GetType ());
+Console.Out.Close ();
+Console.Write ("TEST");
+----
+
+So I think it can be easily fixed not to close Console.Out writer.
+
+Interestingly, MS.NET 1.2 also closes the stream, but I have no idea if it 
+is MS.NET 1.2 bug or not.
+
+------- Additional Comments From ginga@kit.hi-ho.ne.jp  2003-12-12 05:49 -------
+Created an attachment (id=6204)
+Proposed patch.
+
+
+------- Additional Comments From gonzalo@ximian.com  2003-12-12 11:57 -------
+If under current .NET 1.2 it does not close the stream, may be the bug
+is in <= 1.1. Anyway, I would add some #if's for NET_1_2 to behave
+like them.
+
+
+------- Additional Comments From miguel@ximian.com  2004-04-28 20:11 -------
+This is the behavior in .NET 2.0 as well (the new refresh)
+am applying the patch.