ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -unsafe -d:AGCLR -d:NET_2_1_HACK
endif
-TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 -r:System.Data
ifeq (2.0, $(FRAMEWORK_VERSION))
# Happens on net_2_0_bootstrap and net_2_0 profiles
#if MOONLIGHT
throw new NotSupportedException ();
#else
- if (member.TypeData.Type == typeof (XmlElement)) {
+ //
+ // XmlAnyElement can be of XmlElement or XmlNode type
+ //
+ if (member.TypeData.Type == typeof (XmlElement) || member.TypeData.Type == typeof(XmlNode)) {
memberValue = new object[] { memberValue };
}
using System.IO;
using System.Text;
using System.Xml;
+using System.Data;
using System.Xml.Schema;
using System.Xml.Serialization;
#if NET_2_0
new XmlSerializer (typeof (XmlAnyElementForObjectsType)).Serialize (TextWriter.Null, new XmlAnyElementForObjectsType ());
}
+
+ public class Bug2893 {
+ public Bug2893 ()
+ {
+ Contents = new XmlDataDocument();
+ }
+
+ [XmlAnyElement("Contents")]
+ public XmlNode Contents;
+ }
+
+ // Bug Xamarin #2893
+ [Test]
+ public void XmlAnyElementForXmlNode ()
+ {
+ var obj = new Bug2893 ();
+ XmlSerializer mySerializer = new XmlSerializer(typeof(Bug2893));
+ XmlWriterSettings settings = new XmlWriterSettings();
+
+ var xsn = new XmlSerializerNamespaces();
+ xsn.Add(string.Empty, string.Empty);
+
+ byte[] buffer = new byte[2048];
+ var ms = new MemoryStream(buffer);
+ using (var xw = XmlWriter.Create(ms, settings))
+ {
+ mySerializer.Serialize(xw, obj, xsn);
+ xw.Flush();
+ }
+
+ mySerializer.Serialize(ms, obj);
+ }
+
[Test]
public void XmlRootOverridesSchemaProviderQName ()
{