Skip to content

Instantly share code, notes, and snippets.

@brendanzagaeski
Created October 23, 2013 19:17
Show Gist options
  • Save brendanzagaeski/7124853 to your computer and use it in GitHub Desktop.
Save brendanzagaeski/7124853 to your computer and use it in GitHub Desktop.
Proposed fixes for bugs in System.Runtime.Serialization
diff --git a/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs b/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
index f3c707e..8e713d7 100755
--- a/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
+++ b/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
@@ -248,8 +248,10 @@ namespace System.Runtime.Serialization
return;
Type elementType = type;
- if (type.HasElementType)
+ if (type.HasElementType) {
+ known_types.Add (type);
elementType = type.GetElementType ();
+ }
known_types.Add (elementType);
diff --git a/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs b/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs
index b4eae19..f99dbf3 100644
--- a/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs
+++ b/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs
@@ -261,7 +261,7 @@ namespace System.Runtime.Serialization
if (name.StartsWith ("ArrayOf", StringComparison.Ordinal)) {
name = name.Substring (7); // strip "ArrayOf"
if (ns == KnownTypeCollection.MSArraysNamespace)
- return GetTypeFromNamePair (name, String.Empty).MakeArrayType ();
+ return GetTypeFromNamePair (name, ns.Substring (0, ns.LastIndexOf ('/') + 1)).MakeArrayType ();
makeArray = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment