Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: kbsurveynew, kbtshoot, kbexpertiseadvanced, KB2748720

↑ Back to the top

Article Info
Article ID : 2748720
Revision : 3
Created on : 6/6/2013
Published on : 6/6/2013
Exists online : False
Views : 543