Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -86,7 +86,9 @@ namespace System.ServiceModel
int j;
for (j = s.Length; j > 0 && IsWhitespace(s[j - 1]); j--);
#if !MONO
Fx.Assert(j > i, "Logic error in XmlUtil.Trim().");
#endif
if (i != 0 || j != s.Length)
{

View File

@@ -750,7 +750,7 @@ namespace System.Xml {
// This method tests whether a value is in a given range with just one test; start and end should be constants
private static bool InRange(int value, int start, int end) {
Debug.Assert(start <= end);
return (uint)(value - start) <= (uint)(end - start);
return (uint)(value - start) <= (uint)(end - start);
}
#if XMLCHARTYPE_GEN_RESOURCE

View File

@@ -107,6 +107,35 @@ namespace System.ComponentModel {
/// add attributes directly as metadata.
/// </devdoc>
private static Hashtable IntrinsicTypeConverters {
#if MONO
// TODO: typeof (BooleanConverter) would work better
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.BooleanConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.ByteConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.SByteConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.CharConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.DoubleConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.StringConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.Int32Converter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.Int16Converter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.Int64Converter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.SingleConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.UInt16Converter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.UInt32Converter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.UInt16Converter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.TypeConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.CultureInfoConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.DateTimeConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.DateTimeOffsetConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.DecimalConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.TimeSpanConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.GuidConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.ArrayConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor()", "System.ComponentModel.CollectionConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor(System.Type)", "System.ComponentModel.EnumConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor(System.Type)", "System.ComponentModel.ReferenceConverter")]
[System.Runtime.CompilerServices.PreserveDependency (".ctor(System.Type)", "System.ComponentModel.NullableConverter")]
#endif
get {
// It is not worth taking a lock for this -- worst case of a collision
// would build two tables, one that garbage collects very quickly.

View File

@@ -67,7 +67,12 @@ namespace System.Diagnostics {
#if MONO_FEATURE_CAS
new EnvironmentPermission(EnvironmentPermissionAccess.Read, "Path").Assert();
#endif
appName = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
// Make sure we have command line arguments before accessing them
// prevents index out of range exception.
// For example Wasm does not have access to command line arguments through browser
var clArgs = Environment.GetCommandLineArgs();
if (clArgs.Length > 0)
appName = Path.GetFileName(clArgs[0]);
}
return appName;
}

View File

@@ -23,6 +23,7 @@ namespace System.IO {
using System.Globalization;
using System.Diagnostics.Contracts;
using System.Security;
using System.Buffers.Binary;
[System.Runtime.InteropServices.ComVisible(true)]
public class BinaryReader : IDisposable
@@ -243,6 +244,12 @@ namespace System.IO {
try {
int[] ints = new int[4];
Buffer.BlockCopy(m_buffer, 0, ints, 0, 16);
if (!BitConverter.IsLittleEndian) {
// We need to reverse the ints on BE
for (int i = 0; i < 4; i++) {
ints[i] = BinaryPrimitives.ReverseEndianness(ints[i]);
}
}
return new decimal(ints);
}
catch (ArgumentException e) {

View File

@@ -358,7 +358,7 @@ namespace System.Resources {
_store.BaseStream.Seek(_nameSectionOffset + GetNamePosition(index), SeekOrigin.Begin);
lastReadString = _store.ReadString();
}
BCLDebug.Log("RESMGRFILEFORMAT", LogLevel.Status, "FindPosForResource for ", name, " failed. i: ", index, " lo: ", lo, " hi: ", hi, " last read string: \"", lastReadString, '\'');
BCLDebug.Log("RESMGRFILEFORMAT", BCLDebugLogLevel.Status, "FindPosForResource for ", name, " failed. i: ", index, " lo: ", lo, " hi: ", hi, " last read string: \"", lastReadString, '\'');
#endif
return -1;
}
@@ -909,7 +909,7 @@ namespace System.Resources {
throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
}
if (resMgrHeaderVersion > 1) {
BCLDebug.Log("RESMGRFILEFORMAT", LogLevel.Status, "ReadResources: Unexpected ResMgr header version: {0} Skipping ahead {1} bytes.", resMgrHeaderVersion, numBytesToSkip);
BCLDebug.Log("RESMGRFILEFORMAT", BCLDebugLogLevel.Status, "ReadResources: Unexpected ResMgr header version: {0} Skipping ahead {1} bytes.", resMgrHeaderVersion, numBytesToSkip);
_store.BaseStream.Seek(numBytesToSkip, SeekOrigin.Current);
}
else {

View File

@@ -85,7 +85,7 @@ namespace System.Threading
#if MONO
public const uint tpQuantum = 30U;
public static int processorCount => Environment.ProcessorCount;
public static int processorCount = Environment.ProcessorCount;
public static bool tpHosted => ThreadPool.IsThreadPoolHosted();