[Mono-bugs] [Bug 73035][Nor] New - When a class uses a namespace but the base class doens't the fields in the base class should not inherrit the namespace.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 25 Feb 2005 11:25:34 -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 s.rave@ccv.nl.

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

--- shadow/73035	2005-02-25 11:25:34.000000000 -0500
+++ shadow/73035.tmp.31732	2005-02-25 11:25:34.000000000 -0500
@@ -0,0 +1,93 @@
+Bug#: 73035
+Product: Mono: Class Libraries
+Version: 1.1
+OS: SUSE 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: s.rave@ccv.nl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: When a class uses a namespace but the base class doens't the fields in the base class should not inherrit the namespace.
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+When a class uses a namespace but the base class doens't the fields in the
+base class should not inherrit the namespace.
+
+
+Steps to reproduce the problem:
+using System;
+using System.Xml.Serialization;
+using System.IO;
+
+[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schema1")]
+[System.Xml.Serialization.XmlRootAttribute(Namespace="http://schema1",
+IsNullable=false)]
+public class Class1A
+{
+    /// <remarks/>
+    public Class1B Field1A = new Class1B();
+}
+
+    /// <remarks/>
+[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schema1")]
+public class Class1B : Class2A
+{
+    public string Field1B = "Hoi";
+}
+
+    /// <remarks/>
+[System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+public class Class2A
+{
+    public string Field2A = "Hallo";
+}
+
+class ClassTest
+{
+
+    static void Main(string[] args)
+    {
+        XmlSerializer[] s = XmlSerializer.FromTypes(new
+Type[]{typeof(Class1A)});
+        XmlSerializerNamespaces sn = new XmlSerializerNamespaces();
+        sn.Add("s1", "http://schema1");
+
+        s[0].Serialize(Console.Out, new Class1A(), sn);
+    }
+}
+
+Actual Results (Mono 1.1.4):
+<?xml version="1.0" encoding="utf-8"?>
+<s1:Class1A xmlns:s1="http://schema1">
+  <s1:Field1A>
+    <s1:Field2A>Hallo</s1:Field2A>
+    <s1:Field1B>Hoi</s1:Field1B>
+  </s1:Field1A>
+</s1:Class1A>
+
+Expected Results (Microsoft .NET 1.1)
+<?xml version="1.0" encoding="Windows-1252"?>
+<s1:Class1A xmlns:s1="http://schema1">
+  <s1:Field1A>
+    <Field2A>Hallo</Field2A>
+    <s1:Field1B>Hoi</s1:Field1B>
+  </s1:Field1A>
+</s1:Class1A>
+
+
+How often does this happen? 
+always
+
+Additional Information:
+The namespace in the Mono output of Field2A is wrong.
+If the namespace used in Class2A is not empty the output is correct.
+If a serializer is generated from Class1B then the output is correct.