XmlSerialize error: There was an error generating the XML document.

自定义class 做xmlserialize 时候报错: There was an error generating the XML document.

令人非常恼火的错误,参照:

Troubleshooting Common Problem with XmlSerializer http://msdn.microsoft.com/en-us/library/aa302290.aspx

XmlSerializer 常见问题 http://msdn.microsoft.com/zh-cn/library/aa302290.aspx

 

解决办法

1. try catch InvalidOperationException, 查看InnerException,

2. 确保类有Serializable 标记

3. 我这边的问题是没有一个无参数的构造函数

你可能感兴趣的:(Serialize)