mono/MonoGame — pull request #3279 by tomspilman (2014-12-16 19:30:22+00:00)
Title: Content Serialization Fixes

This PR implements a bunch of fixes for the content serialization process.

First I converted the existing `IntermediateSerializer` unit tests to also call the `ContentCompiler` to generate an XNB and then the `ContentManager` to load the serialized type. This round tripping exposed several bugs where the `IntermediateSerializer` worked correctly to XNA behavior, but either the `ContentCompiler` failed to serialize the type into XNB format correctly or the `ContentManager` couldn't load the compiled content type.

This testing solved a few different bugs:

- We were not including the underlying type when serializing `EnumWriter`.
- We were not including the base type when serializing with the `ReflectiveWriter`.
- Fixed serialization and deserialization of polymorphic types (Fixes #2817).
- Fixed case where non-public getters were being ignored.
- Implemented getter for `FontDescription.CharacterRegions`.
- `OpaqueDataDictionary` was missing the content "item name" attribute.
- We now use `CanDeserializeIntoExistingObject` to serialize getter only properties.
- Fixed a few cases where `existingInstance` wasn't being obeyed.
- Cleaned up `ContentReader` removed a lot of redundant code.
- Added clear exception when the `typeReaderIndex` is out of bounds.

Now I haven't tested this beyond just the unit tests. It is possible a broke something, so it would be great for people with lots of content in their game to give this a test before we merge things.

Thanks to @Firedragonweb for poking me on this!