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
@@ -1299,6 +1299,10 @@ namespace System.Runtime.Serialization
|
||||
if (addMethod == null)
|
||||
{
|
||||
Type[] parentInterfaceTypes = interfaceType.GetInterfaces();
|
||||
// The for loop below depeneds on the order for the items in parentInterfaceTypes, which
|
||||
// doesnt' seem right. But it's the behavior of DCS on the full framework.
|
||||
// Sorting the array to make sure the behavior is consistent with Desktop's.
|
||||
Array.Sort(parentInterfaceTypes, (x, y) => string.Compare(x.FullName, y.FullName));
|
||||
foreach (Type parentInterfaceType in parentInterfaceTypes)
|
||||
{
|
||||
if (IsKnownInterface(parentInterfaceType))
|
||||
|
||||
@@ -1 +1 @@
|
||||
257107efef5642950e450c041348b02bbd3e9008
|
||||
84eb6a8bf3754202195b1c8829a1e0b6baf268bd
|
||||
@@ -896,7 +896,6 @@ namespace System.Runtime.Serialization
|
||||
// instead of string comparison method calls in IL.)
|
||||
public static readonly string NewObjectId = string.Empty;
|
||||
public const string NullObjectId = null;
|
||||
public const string SimpleSRSInternalsVisiblePattern = @"^[\s]*System\.Runtime\.Serialization[\s]*$";
|
||||
public const string FullSRSInternalsVisiblePattern = @"^[\s]*System\.Runtime\.Serialization[\s]*,[\s]*PublicKey[\s]*=[\s]*(?i:00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab)[\s]*$";
|
||||
public const string Space = " ";
|
||||
public const string XsiPrefix = "i";
|
||||
@@ -1031,4 +1030,4 @@ namespace System.Runtime.Serialization
|
||||
</xs:schema>
|
||||
";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,6 +374,7 @@ namespace System.Runtime.Serialization.Json
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ResetCollectionMemberInfoMethod);
|
||||
value = ReadValue(memberType, dataMember.Name);
|
||||
_ilg.LoadAddress(_objectLocal);
|
||||
_ilg.ConvertAddress(_objectLocal.LocalType, _objectType);
|
||||
|
||||
@@ -225,6 +225,12 @@ namespace System.Runtime.Serialization.Json
|
||||
_ilg.Load(_contextArg);
|
||||
_ilg.Call(XmlFormatGeneratorStatics.StoreIsGetOnlyCollectionMethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Load(_contextArg);
|
||||
_ilg.Call(XmlFormatGeneratorStatics.ResetIsGetOnlyCollectionMethod);
|
||||
}
|
||||
|
||||
if (!member.EmitDefaultValue)
|
||||
{
|
||||
memberValue = LoadMemberValue(member);
|
||||
|
||||
@@ -207,6 +207,10 @@ namespace System.Runtime.Serialization.Json
|
||||
{
|
||||
context.StoreIsGetOnlyCollection();
|
||||
}
|
||||
else
|
||||
{
|
||||
context.ResetIsGetOnlyCollection();
|
||||
}
|
||||
|
||||
|
||||
bool shouldWriteValue = true;
|
||||
|
||||
@@ -23,14 +23,45 @@ namespace System.Runtime.Serialization.Json
|
||||
private const char WHITESPACE = ' ';
|
||||
private const char CARRIAGE_RETURN = '\r';
|
||||
private const char NEWLINE = '\n';
|
||||
private const char BACKSPACE = '\b';
|
||||
private const char FORM_FEED = '\f';
|
||||
private const char HORIZONTAL_TABULATION = '\t';
|
||||
private const string xmlNamespace = "http://www.w3.org/XML/1998/namespace";
|
||||
private const string xmlnsNamespace = "http://www.w3.org/2000/xmlns/";
|
||||
|
||||
// This array was part of a perf improvement for escaping characters < WHITESPACE.
|
||||
private static readonly string[] s_escapedJsonStringTable = CreateEscapedJsonStringTable();
|
||||
private static readonly string[] s_escapedJsonStringTable =
|
||||
{
|
||||
"\\u0000",
|
||||
"\\u0001",
|
||||
"\\u0002",
|
||||
"\\u0003",
|
||||
"\\u0004",
|
||||
"\\u0005",
|
||||
"\\u0006",
|
||||
"\\u0007",
|
||||
"\\b",
|
||||
"\\t",
|
||||
"\\n",
|
||||
"\\u000b",
|
||||
"\\f",
|
||||
"\\r",
|
||||
"\\u000e",
|
||||
"\\u000f",
|
||||
"\\u0010",
|
||||
"\\u0011",
|
||||
"\\u0012",
|
||||
"\\u0013",
|
||||
"\\u0014",
|
||||
"\\u0015",
|
||||
"\\u0016",
|
||||
"\\u0017",
|
||||
"\\u0018",
|
||||
"\\u0019",
|
||||
"\\u001a",
|
||||
"\\u001b",
|
||||
"\\u001c",
|
||||
"\\u001d",
|
||||
"\\u001e",
|
||||
"\\u001f"
|
||||
};
|
||||
|
||||
private static BinHexEncoding s_binHexEncoding;
|
||||
|
||||
@@ -72,20 +103,6 @@ namespace System.Runtime.Serialization.Json
|
||||
InitializeWriter();
|
||||
}
|
||||
|
||||
private static string[] CreateEscapedJsonStringTable()
|
||||
{
|
||||
var table = new string[WHITESPACE];
|
||||
for (int ch = 0; ch < WHITESPACE; ch++)
|
||||
{
|
||||
char abbrev;
|
||||
table[ch] = TryEscapeControlCharacter((char)ch, out abbrev) ?
|
||||
string.Concat(BACK_SLASH, abbrev) :
|
||||
string.Format(CultureInfo.InvariantCulture, "\\u{0:x4}", ch);
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
private enum JsonDataType
|
||||
{
|
||||
None,
|
||||
@@ -1418,33 +1435,6 @@ namespace System.Runtime.Serialization.Json
|
||||
}
|
||||
}
|
||||
|
||||
private static bool TryEscapeControlCharacter(char ch, out char abbrev)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case BACKSPACE:
|
||||
abbrev = 'b';
|
||||
break;
|
||||
case FORM_FEED:
|
||||
abbrev = 'f';
|
||||
break;
|
||||
case NEWLINE:
|
||||
abbrev = 'n';
|
||||
break;
|
||||
case CARRIAGE_RETURN:
|
||||
abbrev = 'r';
|
||||
break;
|
||||
case HORIZONTAL_TABULATION:
|
||||
abbrev = 't';
|
||||
break;
|
||||
default:
|
||||
abbrev = ' ';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void WriteIndent()
|
||||
{
|
||||
for (int i = 0; i < _indentLevel; i++)
|
||||
|
||||
@@ -205,6 +205,7 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
else
|
||||
{
|
||||
context.ResetCollectionMemberInfo();
|
||||
var value = ReflectionReadValue(xmlReader, context, dataMember, classContract.StableName.Namespace);
|
||||
MemberInfo memberInfo = dataMember.MemberInfo;
|
||||
Debug.Assert(memberInfo != null);
|
||||
|
||||
@@ -144,6 +144,10 @@ namespace System.Runtime.Serialization
|
||||
{
|
||||
context.StoreIsGetOnlyCollection();
|
||||
}
|
||||
else
|
||||
{
|
||||
context.ResetIsGetOnlyCollection();
|
||||
}
|
||||
|
||||
bool shouldWriteValue = true;
|
||||
object memberValue = null;
|
||||
|
||||
@@ -249,6 +249,20 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
private static MethodInfo s_resetCollectionMemberInfoMethod;
|
||||
internal static MethodInfo ResetCollectionMemberInfoMethod
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_resetCollectionMemberInfoMethod == null)
|
||||
{
|
||||
s_resetCollectionMemberInfoMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ResetCollectionMemberInfo", Globals.ScanAllMembers, new Type[] { });
|
||||
Debug.Assert(s_resetCollectionMemberInfoMethod != null);
|
||||
}
|
||||
return s_resetCollectionMemberInfoMethod;
|
||||
}
|
||||
}
|
||||
|
||||
private static MethodInfo s_storeIsGetOnlyCollectionMethod;
|
||||
internal static MethodInfo StoreIsGetOnlyCollectionMethod
|
||||
{
|
||||
@@ -263,6 +277,20 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
private static MethodInfo s_resetIsGetOnlyCollection;
|
||||
internal static MethodInfo ResetIsGetOnlyCollectionMethod
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_resetIsGetOnlyCollection == null)
|
||||
{
|
||||
s_resetIsGetOnlyCollection = typeof(XmlObjectSerializerWriteContext).GetMethod("ResetIsGetOnlyCollection", Globals.ScanAllMembers);
|
||||
Debug.Assert(s_resetIsGetOnlyCollection != null);
|
||||
}
|
||||
return s_resetIsGetOnlyCollection;
|
||||
}
|
||||
}
|
||||
|
||||
private static MethodInfo s_throwNullValueReturnedForGetOnlyCollectionExceptionMethod;
|
||||
internal static MethodInfo ThrowNullValueReturnedForGetOnlyCollectionExceptionMethod
|
||||
{
|
||||
|
||||
@@ -422,6 +422,7 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ResetCollectionMemberInfoMethod);
|
||||
value = ReadValue(memberType, dataMember.Name, classContract.StableName.Namespace);
|
||||
_ilg.LoadAddress(_objectLocal);
|
||||
_ilg.ConvertAddress(_objectLocal.LocalType, _objectType);
|
||||
|
||||
@@ -286,6 +286,12 @@ namespace System.Runtime.Serialization
|
||||
_ilg.Load(_contextArg);
|
||||
_ilg.Call(XmlFormatGeneratorStatics.StoreIsGetOnlyCollectionMethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ilg.Load(_contextArg);
|
||||
_ilg.Call(XmlFormatGeneratorStatics.ResetIsGetOnlyCollectionMethod);
|
||||
}
|
||||
|
||||
if (!member.EmitDefaultValue)
|
||||
{
|
||||
memberValue = LoadMemberValue(member);
|
||||
|
||||
@@ -67,6 +67,12 @@ namespace System.Runtime.Serialization
|
||||
_isGetOnlyCollection = true;
|
||||
}
|
||||
|
||||
internal void ResetCollectionMemberInfo()
|
||||
{
|
||||
_getOnlyCollectionValue = null;
|
||||
_isGetOnlyCollection = false;
|
||||
}
|
||||
|
||||
#if USE_REFEMIT
|
||||
public static void ThrowNullValueReturnedForGetOnlyCollectionException(Type type)
|
||||
#else
|
||||
|
||||
@@ -96,6 +96,11 @@ namespace System.Runtime.Serialization
|
||||
_isGetOnlyCollection = true;
|
||||
}
|
||||
|
||||
internal void ResetIsGetOnlyCollection()
|
||||
{
|
||||
_isGetOnlyCollection = false;
|
||||
}
|
||||
|
||||
#if USE_REFEMIT
|
||||
public void InternalSerializeReference(XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
|
||||
#else
|
||||
@@ -178,18 +183,16 @@ namespace System.Runtime.Serialization
|
||||
protected virtual void SerializeWithXsiType(XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, int declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
|
||||
{
|
||||
bool verifyKnownType = false;
|
||||
#if !uapaot
|
||||
DataContract dataContract;
|
||||
if (declaredType.IsInterface && CollectionDataContract.IsCollectionInterface(declaredType))
|
||||
{
|
||||
#if !uapaot
|
||||
dataContract = GetDataContractSkipValidation(DataContract.GetId(objectTypeHandle), objectTypeHandle, objectType);
|
||||
if (OnHandleIsReference(xmlWriter, dataContract, obj))
|
||||
return;
|
||||
dataContract = GetDataContract(declaredTypeHandle, declaredType);
|
||||
#else
|
||||
DataContract dataContract = DataContract.GetDataContract(declaredType);
|
||||
if (dataContract.TypeIsInterface && dataContract.TypeIsCollectionInterface)
|
||||
{
|
||||
dataContract = DataContract.GetDataContract(declaredType);
|
||||
if (OnHandleIsReference(xmlWriter, dataContract, obj))
|
||||
return;
|
||||
if (this.Mode == SerializationMode.SharedType && dataContract.IsValidContract(this.Mode))
|
||||
|
||||
@@ -206,9 +206,9 @@ namespace System.Xml
|
||||
// Emit BOM
|
||||
if (emitBOM)
|
||||
{
|
||||
byte[] bom = _encoding.GetPreamble();
|
||||
ReadOnlySpan<byte> bom = _encoding.Preamble;
|
||||
if (bom.Length > 0)
|
||||
_stream.Write(bom, 0, bom.Length);
|
||||
_stream.Write(bom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,8 +326,11 @@ namespace System.Xml
|
||||
if (type == ValueHandleType.Double)
|
||||
{
|
||||
double value = GetDouble();
|
||||
if ((value >= Single.MinValue && value <= Single.MaxValue) || double.IsInfinity(value) || double.IsNaN(value))
|
||||
|
||||
if ((value >= Single.MinValue && value <= Single.MaxValue) || !double.IsFinite(value))
|
||||
{
|
||||
return (Single)value;
|
||||
}
|
||||
}
|
||||
if (type == ValueHandleType.Zero)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user