You've already forked linux-packaging-mono
							
							Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
		
						parent
						
							88ff76fe28
						
					
				
				
					commit
					e46a49ecf1
				
			| @@ -1113,8 +1113,23 @@ namespace System.Xml.Serialization { | ||||
|                     case TypeCode.Empty: | ||||
|                     case TypeCode.DBNull: | ||||
|                     default: | ||||
|                         Debug.Assert(false, "UnknownConstantType"); | ||||
|                         throw new NotSupportedException("UnknownConstantType"); //.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.UnknownConstantType, DataContract.GetClrTypeFullName(valueType)))); | ||||
|                         if (valueType == typeof(TimeSpan) && LocalAppContextSwitches.EnableTimeSpanSerialization) | ||||
|                         { | ||||
|                             ConstructorInfo TimeSpan_ctor = typeof(TimeSpan).GetConstructor( | ||||
|                             CodeGenerator.InstanceBindingFlags, | ||||
|                             null, | ||||
|                             new Type[] { typeof(Int64) }, | ||||
|                             null | ||||
|                             ); | ||||
|                             Ldc(((TimeSpan)o).Ticks); // ticks | ||||
|                             New(TimeSpan_ctor); | ||||
|                             break; | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             Debug.Assert(false, "UnknownConstantType"); | ||||
|                             throw new NotSupportedException("UnknownConstantType"); //.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.UnknownConstantType, DataContract.GetClrTypeFullName(valueType)))); | ||||
|                         } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -154,6 +154,18 @@ namespace System.Xml.Serialization { | ||||
|             WriteElementStringRaw(@"guid", @"", System.Xml.XmlConvert.ToString((System.Guid)((System.Guid)o))); | ||||
|         } | ||||
|  | ||||
|         internal void Write_TimeSpan(object o) | ||||
|         { | ||||
|             WriteStartDocument(); | ||||
|             if (o == null) | ||||
|             { | ||||
|                 WriteEmptyTag(@"TimeSpan", @""); | ||||
|                 return; | ||||
|             } | ||||
|             TimeSpan timeSpan = (TimeSpan)o; | ||||
|             WriteElementStringRaw(@"TimeSpan", @"", System.Xml.XmlConvert.ToString(timeSpan)); | ||||
|         } | ||||
|  | ||||
|         internal void Write_char(object o) { | ||||
|             WriteStartDocument(); | ||||
|             if (o == null) { | ||||
| @@ -489,6 +501,38 @@ namespace System.Xml.Serialization { | ||||
|             return (object)o; | ||||
|         } | ||||
|  | ||||
|         internal object Read_TimeSpan() | ||||
|         { | ||||
|             object o = null; | ||||
|             Reader.MoveToContent(); | ||||
|             if (Reader.NodeType == System.Xml.XmlNodeType.Element) | ||||
|             { | ||||
|                 if (((object)Reader.LocalName == (object)id19_TimeSpan && (object)Reader.NamespaceURI == (object)id2_Item)) | ||||
|                 { | ||||
|                     if (Reader.IsEmptyElement) | ||||
|                     { | ||||
|                         Reader.Skip(); | ||||
|                         //For backward compatibiity  | ||||
|                         //When using old serializer, the serialized TimeSpan value is empty string | ||||
|                         o = default(TimeSpan); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         o = System.Xml.XmlConvert.ToTimeSpan(Reader.ReadElementString()); | ||||
|                     } | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     throw CreateUnknownNodeException(); | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 UnknownNode(null); | ||||
|             } | ||||
|             return (object)o; | ||||
|         } | ||||
|  | ||||
|         internal object Read_char() { | ||||
|             object o = null; | ||||
|             Reader.MoveToContent(); | ||||
| @@ -542,6 +586,7 @@ namespace System.Xml.Serialization { | ||||
|         System.String id9_decimal; | ||||
|         System.String id8_double; | ||||
|         System.String id17_guid; | ||||
|         System.String id19_TimeSpan; | ||||
|         System.String id2_Item; | ||||
|         System.String id13_unsignedShort; | ||||
|         System.String id18_char; | ||||
| @@ -563,6 +608,10 @@ namespace System.Xml.Serialization { | ||||
|             id9_decimal = Reader.NameTable.Add(@"decimal"); | ||||
|             id8_double = Reader.NameTable.Add(@"double"); | ||||
|             id17_guid = Reader.NameTable.Add(@"guid"); | ||||
|             if (LocalAppContextSwitches.EnableTimeSpanSerialization) | ||||
|             { | ||||
|                 id19_TimeSpan = Reader.NameTable.Add(@"TimeSpan"); | ||||
|             } | ||||
|             id2_Item = Reader.NameTable.Add(@""); | ||||
|             id13_unsignedShort = Reader.NameTable.Add(@"unsignedShort"); | ||||
|             id18_char = Reader.NameTable.Add(@"char"); | ||||
|   | ||||
| @@ -485,6 +485,10 @@ namespace System.Xml.Serialization { | ||||
|  | ||||
|             AddNonXsdPrimitive(typeof(Guid), "guid", UrtTypes.Namespace, "Guid", new XmlQualifiedName("string", XmlSchema.Namespace), new XmlSchemaFacet[] { guidPattern }, TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.XmlEncodingNotRequired | TypeFlags.IgnoreDefault); | ||||
|             AddNonXsdPrimitive(typeof(char), "char", UrtTypes.Namespace, "Char", new XmlQualifiedName("unsignedShort", XmlSchema.Namespace), new XmlSchemaFacet[0], TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.IgnoreDefault); | ||||
|             if (LocalAppContextSwitches.EnableTimeSpanSerialization) | ||||
|             { | ||||
|                 AddNonXsdPrimitive(typeof(TimeSpan), "TimeSpan", UrtTypes.Namespace, "TimeSpan", new XmlQualifiedName("duration", XmlSchema.Namespace), new XmlSchemaFacet[0], TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.XmlEncodingNotRequired); | ||||
|             } | ||||
|  | ||||
|             AddSoapEncodedTypes(Soap.Encoding); | ||||
|  | ||||
| @@ -525,6 +529,8 @@ namespace System.Xml.Serialization { | ||||
|                         return true; | ||||
|                     else if (type == typeof(Guid)) | ||||
|                         return true; | ||||
|                     else if (LocalAppContextSwitches.EnableTimeSpanSerialization && type == typeof(TimeSpan)) | ||||
|                         return true; | ||||
|                     else if (type == typeof(XmlNode[])) { | ||||
|                         return true; | ||||
|                     } | ||||
|   | ||||
| @@ -1 +1 @@ | ||||
| 5a3d21642d46f4e2e06e88f9fc591742bf823d14 | ||||
| 64be0a91128eb66e3c122685d18b2139659a9f02 | ||||
| @@ -1 +1 @@ | ||||
| 6ba4b2d7fb5998e5aa8751d6aee797b977883f02 | ||||
| 918b405d554f8ab363b414a3ba4f1ffa72b5cc88 | ||||
| @@ -1 +1 @@ | ||||
| d15b2bf9bf55da3fee70ba528b0a9592c1d3f194 | ||||
| fbb688875939e12e36445f8bc682eef0150e41fb | ||||
| @@ -793,6 +793,9 @@ namespace System.Xml.Serialization { | ||||
|                 else if (primitiveType == typeof(Guid)) { | ||||
|                     writer.Write_guid(o); | ||||
|                 } | ||||
|                 else if (primitiveType == typeof(TimeSpan)) { | ||||
|                     writer.Write_TimeSpan(o); | ||||
|                 } | ||||
|                 else { | ||||
|                     throw new InvalidOperationException(Res.GetString(Res.XmlUnxpectedType, primitiveType.FullName)); | ||||
|                 } | ||||
| @@ -853,17 +856,20 @@ namespace System.Xml.Serialization { | ||||
|  | ||||
|             default: | ||||
|                 if (primitiveType == typeof(XmlQualifiedName)) { | ||||
|                     o = reader.Read_QName(); | ||||
|                 } | ||||
|                         o = reader.Read_QName(); | ||||
|                     } | ||||
|                 else if (primitiveType == typeof(byte[])) { | ||||
|                     o = reader.Read_base64Binary(); | ||||
|                 } | ||||
|                         o = reader.Read_base64Binary(); | ||||
|                     } | ||||
|                 else if (primitiveType == typeof(Guid)) { | ||||
|                     o = reader.Read_guid(); | ||||
|                 } | ||||
|                         o = reader.Read_guid(); | ||||
|                     } | ||||
|                 else if (primitiveType == typeof(TimeSpan) && LocalAppContextSwitches.EnableTimeSpanSerialization) { | ||||
|                         o = reader.Read_TimeSpan(); | ||||
|                     } | ||||
|                 else { | ||||
|                     throw new InvalidOperationException(Res.GetString(Res.XmlUnxpectedType, primitiveType.FullName)); | ||||
|                 } | ||||
|                         throw new InvalidOperationException(Res.GetString(Res.XmlUnxpectedType, primitiveType.FullName)); | ||||
|                     } | ||||
|                 break; | ||||
|             } | ||||
|             return o; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user