-Added serialization constructors to all Exceptions
-Added support for serialization event attributes on base classes -Changed WriteEndObject, WriteEndArray, WriteEndConstructor on JsonWriter to be virtual
This commit is contained in:
@@ -41,5 +41,5 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("4.0.2.0")]
|
||||
#if !PocketPC
|
||||
[assembly: AssemblyFileVersion("4.0.2.13825")]
|
||||
[assembly: AssemblyFileVersion("4.0.2.13904")]
|
||||
#endif
|
||||
|
||||
@@ -232,6 +232,32 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
// This value was set after deserialization.
|
||||
}
|
||||
|
||||
public class SerializationEventBaseTestObject
|
||||
{
|
||||
public string TestMember { get; set; }
|
||||
|
||||
[OnSerializing]
|
||||
internal void OnSerializingMethod(StreamingContext context)
|
||||
{
|
||||
TestMember = "Set!";
|
||||
}
|
||||
}
|
||||
|
||||
public class SerializationEventContextSubClassTestObject : SerializationEventBaseTestObject
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializationEventContextTestObjectSubClassTest()
|
||||
{
|
||||
SerializationEventContextSubClassTestObject obj = new SerializationEventContextSubClassTestObject();
|
||||
|
||||
string json = JsonConvert.SerializeObject(obj, Formatting.Indented);
|
||||
Assert.AreEqual(@"{
|
||||
""TestMember"": ""Set!""
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !SILVERLIGHT
|
||||
public class SerializationEventContextTestObject
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user