[System.Runtime.Serialization] Static writer fix.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 29 Feb 2016 19:10:55 +0000 (19:10 +0000)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Tue, 29 Mar 2016 09:09:38 +0000 (10:09 +0100)
commit8a1e9242f6d25e408644d0339dcf5c222d95671d
treeec31644345fabc73e38713bf0cf0c35894ae10a1
parente8744b6fc010b497b44143c8a9cbc7a67ca4c026
[System.Runtime.Serialization] Static writer fix.

While serializing any type into a contract member of type object an
exception would be thrown.

To avoid this XmlObjectSerializerWriteContext.InternalSerialize should
in this case be called using the object type instead of the member type,
similar how reference sources does in  type instead of the member type,
 referencesources seems to be doing omething similar [1].

Fixes #37116.

[1]
http://referencesource.microsoft.com/#System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs,619
mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatWriterGenerator_static.cs