[Mono-bugs] [Bug 43431][Nor] New - StringWriter fails if CultureInfo passed to its constructor

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 20 May 2003 23:26:22 -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 ianm@activestate.com.

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

--- shadow/43431	Tue May 20 23:26:22 2003
+++ shadow/43431.tmp.30282	Tue May 20 23:26:22 2003
@@ -0,0 +1,44 @@
+Bug#: 43431
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: behaviour observed on windows and gentoo linux
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ianm@activestate.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: StringWriter fails if CultureInfo passed to its constructor
+
+The stringWriter class has a constructor that takes a 
+System.IFormatProvider  argument. If an instance is created passing
+CultureInfo.InvariantCulture then the write methods of the stringWriter
+will fail with :
+Unhandled Exception: System.NullReferenceException: A null value was found
+where
+ an object instance was required
+in <0x0004e> 00 System.IO.StringWriter:Write (string)
+
+the failure occurs when running the sample below:
+
+using System;
+using System.IO;
+using System.Text;
+using System.Globalization;
+
+
+public class StringWriterTest {
+    public static void Main( string[] args ) {       
+        StringWriter bodyWriter = new
+StringWriter(CultureInfo.InvariantCulture); //        
+        bodyWriter.Write("foo");
+        bodyWriter.WriteLine("foo bar");
+        Console.WriteLine(bodyWriter.ToString());       
+    }
+}