Skip to content

Instantly share code, notes, and snippets.

@migueldeicaza
Created December 4, 2015 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save migueldeicaza/7dc33952ec47b9c37830 to your computer and use it in GitHub Desktop.
Save migueldeicaza/7dc33952ec47b9c37830 to your computer and use it in GitHub Desktop.
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatWriterGenerator_static.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatWriterGenerator_static.cs
index 00e39ab..77bd5b0 100644
--- a/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatWriterGenerator_static.cs
+++ b/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatWriterGenerator_static.cs
@@ -457,6 +457,7 @@ namespace System.Runtime.Serialization
writer.WriteEndElement ();
}
+ public void Foobarista(){}
void WriteValue (Type memberType, object memberValue, bool writeXsiType)
{
Pointer memberValueRefPointer = null;
@@ -469,8 +470,13 @@ namespace System.Runtime.Serialization
PrimitiveDataContract primitiveContract = PrimitiveDataContract.GetPrimitiveDataContract(memberType);
if (primitiveContract != null && !writeXsiType)
primitiveContract.XmlFormatContentWriterMethod.Invoke (writer, new object [] {memberValue});
- else
- InternalSerialize(XmlFormatGeneratorStatics.InternalSerializeMethod, () => memberValue, memberType, writeXsiType);
+ else {
+ // InternalSerialize(XmlFormatGeneratorStatics.InternalSerializeMethod, () => memberValue, memberType, writeXsiType);
+ var typeHandleValue = Type.GetTypeHandle (memberValue);
+ var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (memberValue, memberType, Globals.TypeOfObject));
+ ctx.InternalSerialize (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
+ Console.WriteLine ("New serializer");
+ }
}
else
{
@@ -500,8 +506,14 @@ namespace System.Runtime.Serialization
if (isNull2) {
XmlFormatGeneratorStatics.WriteNullMethod.Invoke (ctx, new object [] {writer, memberType, DataContract.IsTypeSerializable(memberType)});
} else {
- InternalSerialize((isNullableOfT ? XmlFormatGeneratorStatics.InternalSerializeMethod : XmlFormatGeneratorStatics.InternalSerializeReferenceMethod),
- () => memberValue, memberType, writeXsiType);
+ var typeHandleValue = Type.GetTypeHandle (memberValue);
+ var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (memberValue, memberType, Globals.TypeOfObject));
+ Console.WriteLine ("FOO serializer1");
+ if (isNullableOfT)
+ ctx.InternalSerialize (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
+ else
+ ctx.InternalSerializeReference (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
+ //InternalSerialize((isNullableOfT ? XmlFormatGeneratorStatics.InternalSerializeMethod : XmlFormatGeneratorStatics.InternalSerializeReferenceMethod), () => memberValue, memberType, writeXsiType);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment