+2010-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SerializationMap.cs, KnownTypeCollection.cs : differentiate
+ [DataContract(Namespace=null)] and [DataContract(Namespace="")].
+ Fixed bug #568763.
+
2009-12-01 Sebastien Pouliot <sebastien@ximian.com>
* DataContractSerializer.cs: Add two missing methods for FX3.0
ns = DefaultClrNamespaceBase + type.Namespace;
if (name == null)
- name = type.Namespace == null || type.Namespace.Length == 0 ? type.Name : type.FullName.Substring (type.Namespace.Length + 1).Replace ('+', '.');
+ name = type.Namespace == null ? type.Name : type.FullName.Substring (type.Namespace.Length + 1).Replace ('+', '.');
return new QName (name, ns);
}
{
KnownTypes = knownTypes;
RuntimeType = type;
- if (qname.Namespace == String.Empty)
+ if (qname.Namespace == null)
qname = new QName (qname.Name,
- "http://schemas.datacontract.org/2004/07/" + type.Namespace);
+ KnownTypeCollection.DefaultClrNamespaceBase + type.Namespace);
XmlName = qname;
Members = new List<DataMemberInfo> ();
+2010-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlObjectSrializerTest.cs : added test for bug #568763.
+
2009-09-28 Atsushi Enomoto <atsushi@ximian.com>
* XsdDataContractExporterTest.cs : disable some tests that started
Assert.AreEqual (expected, sw.ToString ());
}
+ // DCEmpty
+
+ [Test]
+ public void SerializeEmptyNoNSClass ()
+ {
+ var ser = new DataContractSerializer (typeof (DCEmptyNoNS));
+ SerializeEmptyNoNSClass (ser, "<DCEmptyNoNS xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" />");
+ }
+
+ void SerializeEmptyNoNSClass (XmlObjectSerializer ser, string expected)
+ {
+ var sw = new StringWriter ();
+ using (var w = XmlWriter.Create (sw, settings)) {
+ ser.WriteObject (w, new DCEmptyNoNS ());
+ }
+ Assert.AreEqual (expected, sw.ToString ());
+ }
// string (primitive)
[Test]
public string Foo = "TEST";
}
+ [DataContract (Namespace = "")]
+ public class DCEmptyNoNS
+ {
+ }
+
[DataContract]
public class DCSimple1
{