1

I am using AppFabric caching in my C# application. I am attempting to cache a XmlDocument but getting the following error:

Type 'System.Xml.XmlDocument' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.

How can I resolve this issue?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
amateur
  • 43,371
  • 65
  • 192
  • 320
  • 2
    Why not just store the XML as a string, rather than as an serialized XmlDocument class? – mdm Jul 07 '11 at 19:34
  • possible duplicate of [C#: wcf return an XmlDocument?](http://stackoverflow.com/questions/964870/c-wcf-return-an-xmldocument) – Rubens Farias Jul 07 '11 at 19:43

1 Answers1

-1

Had the same issue, and solved it by marking the property/field that contained the XML document as NonSerializable.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574