Serialization or deserialization failures when you run existing XML serialization code in WCF 4.5

Article translations Article translations
Article ID: 2748720 - View products that this article applies to.
Expand all | Collapse all

Symptoms

When you run existing XML serialization code in Microsoft Windows Communication Foundation (WCF) 4.5, some serialization or deserialization failures may occur.

Note The existing XML serialization code was compiled and run successfully in Microsoft WCF 4.

Cause

The XmlSerializer class is optimized to remove its dependency on the C# compiler in WCF 4.5. This optimization improves performance greatly for cold startup scenarios. However, this optimization may cause some differences in the serialization behavior from WCF 4.

Resolution

To resolve this issue, apply one of the updates that are described in the following Knowledge Base (KB) articles:
2805221 An update is available for the .NET Framework 4.5 in Windows 7 SP1, Windows Server 2008 R2 SP1, Windows Server 2008 SP2, and Windows Vista SP2: May 2013
2805222 An update is available for the .NET Framework 4.5 in Windows 8, Windows RT and Windows Server 2012: May 2013
Note For more information about this issue, see "Issue 1" in the "WCF" section.

Workaround

To work around these serialization issues, you can set the XmlSerializer class to revert to WCF 4.0 behavior. To do this, use the following configuration element:
<configuration>
<system.xml.serialization>
<xmlSerializer useLegacySerializerGeneration="true"/>
</system.xml.serialization>
</configuration>
Note We do not recommend that you apply this workaround on a computer that is running a version of the .Net framework that is earlier than the .Net framework 4.5.

Properties

Article ID: 2748720 - Last Review: June 6, 2013 - Revision: 3.0
Applies to
  • Microsoft .NET Framework 4.5
  • Windows Communication Foundation 4.5
Keywords: 
kbsurveynew kbtshoot kbexpertiseadvanced KB2748720

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com