[Mono-bugs] [Bug 29886][Min] New - When you try to create a XmlTextWriter with a null reference of encoding parameter it throws a NullRefernceException

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
4 Sep 2002 18:23:12 -0000


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 notzcoolx@yahoo.es.

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

--- shadow/29886	Wed Sep  4 14:23:12 2002
+++ shadow/29886.tmp.30435	Wed Sep  4 14:23:12 2002
@@ -0,0 +1,53 @@
+Bug#: 29886
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Debian Woody
+OS Details: Mono 0.15 (I used apt-get from "deb http://www.debianplanet.org/mono stable release")
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: System.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: notzcoolx@yahoo.es               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: When you try to create a XmlTextWriter with a null reference of encoding parameter it throws a NullRefernceException
+
+Description of Problem:
+When you try to create a XmlTextWriter with a null reference of encoding
+parameter it throws a NullRefernceException. In .Net Framework SDK
+documentation says that if a null reference is used the XmlTextWriter will
+use UTF-8 encoding.
+
+Steps to reproduce the problem:
+1. Try to write this program:
+   public class XmlBug
+   {
+       public static void Main()
+       {
+           System.Xml.XmlTextWriter writer = new
+System.Xml.XmlTextWriter("test.xml", null);
+           writer.Close();
+       }
+   }
+
+Actual Results:
+If you run the program you will be prompted with this:
+Unhandled Exception: System.ArgumentNullException: Argument cannot be null
+Parameter name: encoding
+in <0x0018b> 00 System.IO.StreamWriter:.ctor
+(string,bool,System.Text.Encoding,int)
+in <0x00076> 00 System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding)
+in <0x0012f> 00 System.Xml.XmlTextWriter:.ctor (string,System.Text.Encoding)
+in <0x00032> 00 .XmlBug:Main ()
+
+
+Expected Results:
+No Exception have to be thrown. The XmlTextWriter constructor have to
+assing the right encoder.
+
+How often does this happen? 
+This always happen when i try to use a null encoding.