JamesNK/Newtonsoft.Json — pull request #56 by xpaulbettsx (2013-02-12 10:06:42+00:00)
Title: Call base classes' "On[De]Serializ[ing|ed]" as well as derived class

Consider the following code:

```cs
[DataContract]
public class Foo
{
public Foo()
{
postSerializeSetup(default(StreamingContext));
}

[OnDeserialized]
void postSerializeSetup(StreamingContext sc)
{
Console.WriteLine("Foo");
}
}

[DataContract]
public class Bar : Foo
{
public Bar()
{
postSerializeSetup(default(StreamingContext));
}

[OnDeserialized]
void postSerializeSetup(StreamingContext sc)
{
B = Guid.NewGuid();
}
}
```

Currently, the output of deserializing a `Bar` will be:

```
Foo ## Ctor call for Foo
Bar ## Ctor call for Bar
Bar ## Actual OnDeserialized for Bar
```

However, I posit that OnDeserialized should work more like a constructor, and *all* of the `OnDeserialized`'s should be called, from lowest in the class hierarchy to highest. So, the output would be

```
Foo ## Ctor call for Foo
Bar ## Ctor call for Bar
Foo ## Actual OnDeserialized for Foo
Bar ## Actual OnDeserialized for Bar
```

The current behavior makes it very difficult to initialize non-serialized properties of classes that depend on serialized properties.

## TODO:

- [ ] Walk the inheritance tree in [GetCallbackMethodsForType](https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs#L592) in order to build the list of MethodInfos for each attribute type
- [ ] Change any internal code that uses `JsonContract.On[De]serializ[ing|ed]` to use `JsonContract.On[De]serializ[ing|ed]Methods` instead, including the code that actually dispatches the callbacks
- [ ] Write All The Tests