+2008-04-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlTypeMapping.cs : .NET 2.0 has a weird behavior that swallows
+ exception from IXmlSerializable.GetSchema().
+
2008-04-01 Lluis Sanchez Gual <lluis@novell.com>
* TypeData.cs: Prefix with a '@' type names that are equal to keywords.
}
#endif
IXmlSerializable serializable = (IXmlSerializable)Activator.CreateInstance (typeData.Type, true);
+#if NET_2_0
+ try {
+ _schema = serializable.GetSchema();
+ } catch (Exception) {
+ // LAMESPEC: .NET has a bad exception catch and swallows it silently.
+ }
+#else
_schema = serializable.GetSchema();
+#endif
if (_schema != null)
{
if (_schema.Id == null || _schema.Id.Length == 0)
+2008-04-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSerializerTestClasses.cs, XmlSerializerTests.cs : added test
+ for IXmlSerializable serialization whose GetSchema() borks.
+
2008-04-01 Lluis Sanchez Gual <lluis@novell.com>
* XmlSerializerTestClasses.cs, XmlSerializerTests.cs: Test nullable
[SoapEnum ("Large")]
B
}
+
+ public class ErrorneousGetSchema : IXmlSerializable
+ {
+ public XmlSchema GetSchema ()
+ {
+ throw new ApplicationException ("unexpected");
+ }
+
+ public void ReadXml (XmlReader reader)
+ {
+ }
+
+ public void WriteXml (XmlWriter writer)
+ {
+ }
+
+ // it should be serialized IF it is NOT IXmlSerializable.
+ public string Whoa = "whoa";
+ }
}
ser.Serialize (TextWriter.Null, new InvalidTypeContainer ());
}
+ [Test]
+#if !NET_2_0
+ [ExpectedException (typeof (ApplicationException))]
+#endif
+ public void SerializeErrorneousIXmlSerializable ()
+ {
+ Serialize (new ErrorneousGetSchema ());
+ Assert.AreEqual ("<:ErrorneousGetSchema></>", Infoset (sw.ToString ()));
+ }
+
#if NET_2_0
public void DateTimeRoundtrip ()
{