JamesNK/Newtonsoft.Json — pull request #194 by mschaad (2014-01-24 06:05:45+00:00)
Title: added 2 test cases re: bugs in serializing singletons that implement ISerializable

Added 2 test cases against support for ISerializable, with sanity checks against BinaryFormatter (I can understand if you want to delete these; I just wanted to prove that it works.)

The first bug is that the serializer checks for the conventional deserialization constructor at serialization time. This is wrong because the serialization constructor might be unnecessary (as is the case for singleton objects that serialize references to themselves rather than serializing themselves).

The second bug is that the serializer ignores the call to [info.SetType(Type)] in the target object's [GetData(SerializationInfo info, StreamContext context)] method, and instead assumes that it should serialize the actual object rather than the specified surrogate.