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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 12 Dec 2003 05:48:10 -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 ginga@kit.hi-ho.ne.jp.


--- shadow/52094	2003-12-12 05:48:10.000000000 -0500
+++ shadow/52094.tmp.27214	2003-12-12 05:48:10.000000000 -0500
@@ -0,0 +1,50 @@
+Bug#: 52094
+Product: Mono/Class Libraries
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ginga@kit.hi-ho.ne.jp               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+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.