[Mono-bugs] [Bug 75798][Maj] New - XmlSerializer prepends 3 garbage characters when serializing to stream

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Aug 12 17:10:57 EDT 2005


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 caetano at gmail.com.

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

--- shadow/75798	2005-08-12 17:10:57.000000000 -0400
+++ shadow/75798.tmp.22384	2005-08-12 17:10:57.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 75798
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: Fedora Core 4
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Sys.XML
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: caetano at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlSerializer prepends 3 garbage characters when serializing to stream
+
+Description of Problem:
+
+When running on linux (tested with Fedora Core 4) the XmlSerializer
+produces an xml document with 3 garbage characters prepended to the string.
+
+
+Steps to reproduce the problem:
+
+1. Run the following piece of code
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+
+class MainClass
+{
+        public static void Main(string[] args)
+        {
+                string something = "Hello World";
+
+                MemoryStream stream = new MemoryStream();
+                XmlSerializer x = new XmlSerializer(something.GetType());
+                x.Serialize(stream, something);
+
+                Byte[] bytes = stream.ToArray();
+
+                string xml = Encoding.ASCII.GetString(bytes);
+
+                Console.WriteLine(xml);
+        }
+}
+
+Actual Results:
+
+<?xml version="1.0" encoding="utf-8"?>
+<string>Hello World</string>
+
+Notice the 3 characters before the first angle bracket.
+
+
+Expected Results:
+<?xml version="1.0" encoding="utf-8"?>
+<string>Hello World</string>
+
+
+How often does this happen? 
+
+The problem is reproducible.
+
+
+Additional Information:
+
+It happens on linux but I'm unable to reproduce the problem on Mono running
+under Windows.


More information about the mono-bugs mailing list