Oops Null Pointer

Java programming related

C# Error Serialising IList

Recently I hit an error trying to Serialize a IList (with the actual type being an ArrayList) in C#. The only error I could get was:

System.InvalidOperationException: There is an error in XML document

which was not particularly helpful. As far as I can tell the System.Xml.Serialization.XmlSerializer can’t serialise IList as the root node, but has no issues if the IList is a child node.

I found one workaround here that uses a IXmlSerializable wrapper for IList.

(I tried to use a z in serialise when it refers to a method, but couldn’t bring myself to break with Australian English for other uses!)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: