1

Closed

Breaking change in 4.5 release 2

description

We have a classes that were already marked by Serializable attribute because we need to support multiple serialization types, including Json. We use default JsonSerializer settings with no extra options. Serialized data with 4.5 release 2 are completely different and not compatible with previous serializer behavior. As a result application using 4.5 release 2 will return empty objects when deserializing data created by application with 4.5 release 1 or older. Same issue happens the other way around.
 
Can you please revert this to use the old behavior by default. Currently 4.5 release 1 and release 2 assemblies are indistinguishable in .NET (same version 4.5.0.0) and it was explicitly stated that there will be no breaking changes between releases.
Closed Apr 13, 2012 at 2:12 PM by JamesNK
I've changed it so that Json.NET ignores the [Serializable] attribute by default in release 3. Post here if you still have any issues with it.

comments

xgene wrote Apr 12, 2012 at 5:24 PM

I had a similar issue upon upgrading to 4.5.2. Classes marked with [Serializable] and delivered via a Web API class using Json.net as the serializer were munged:

With serializable attribute:
[{"k__BackingField":"d58cb294-9831-4c76-bf66-420ed7a20c15","...
And without:
[{userId: "d58cb294-9831-4c76-bf66-420ed7a20c15",...

JamesNK wrote Apr 12, 2012 at 10:41 PM

Its something I had thought I had done in 4.5 r1 but it slipped to 4.5 r2. It might end up that the version number never changes again - strong naming plus a changing version number hurts a lot of people.
To work around the issue follow the instructions here - http://json.codeplex.com/discussions/351981

JamesNK wrote Apr 12, 2012 at 10:53 PM

I'll have a think about this, I might default IgnoreSerializableAttribute to true.