Serialization breaks in .NET 4.5

后端 未结 5 1682
栀梦
栀梦 2020-11-29 09:17

We have a serialization issue which only happens in .NET 4.5 - same code works fine in .NET 4. we\'re trying to serialize an inherited type with a few fields, both base and

5条回答
  •  情书的邮戳
    2020-11-29 10:06

    I had a also such a serialization failure. In my case it was caused by a type mismatch of the [DefaultValue(..)] attributes. I had an attached default value of "1.0d" (a double) for a property of type decimal. It seems that the new implementation of the XmlSerializer can't convert such values anymore but the old one could. There is also the option to switch back to the old version of XmlSerializer by adding an attribute in 'App.config' but this is not recommended by Microsoft (and me). Hope this helps someone.

提交回复
热议问题