Home Dashboard Directory Help

XmlSerialization of shadowed properties, behavior change from .NET 4.0 to .NET 4.5 by Erv Walter (Epic)


 as Duplicate Help for as Duplicate

Sign in
to vote
Type: Bug
ID: 777892
Opened: 1/30/2013 6:45:22 AM
Access Restriction: Public
User(s) can reproduce this bug


In .NET 4.0, shadowed properties were serialized using the derived type's implementation of the property. In .NET 4.5, the serializer is using the base class' implementation of the property.

See details below for sample code to reproduce this.
Sign in to post a comment.
Posted by Microsoft on 2/27/2013 at 2:34 PM
This issue is already being tracked through this connect issue: http://connect.microsoft.com/VisualStudio/feedback/details/761786/net-4-5-xmlserializer-produces-different-output-from-4-0. We are currently working on a fix for this.
Posted by Microsoft on 1/30/2013 at 9:20 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Erv Walter (Epic) on 1/30/2013 at 2:28 PM
My report appears to be a duplicate of this bug report:


I don't see a way to close this myself, though. I will add the workaround from the other bug to this one in case someone stumbles on this report and wants to see the workaround.
Posted by Microsoft on 1/30/2013 at 6:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Erv Walter (Epic) on 1/30/2013 at 2:28 PM
From this bug report: https://connect.microsoft.com/VisualStudio/feedback/details/761786/net-4-5-xmlserializer-produces-different-output-from-4-0#details

Add the following setting to your application config file and restart your application. Your application should work like before.

<xmlSerializer useLegacySerializerGeneration="true" />
File Name Submitted By Submitted On File Size  
Program.cs 1/30/2013 1 KB