Imported Upstream version 6.6.0.89

Former-commit-id: b39a328747c2f3414dc52e009fb6f0aa80ca2492
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-09-24 08:53:40 +00:00
parent cf815e07e0
commit 95fdb59ea6
2556 changed files with 138145 additions and 47453 deletions

View File

@@ -1 +1 @@
16e4366036bbbda6a76e190ccf312d642e560318
78673562a9c1ebd8895e1f6d6fca65d9b978c4d7

View File

@@ -19,8 +19,9 @@ namespace System.Diagnostics {
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading;
using System.Collections;
using System.Threading;
using System.Collections;
using Microsoft.Win32.SafeHandles;
internal delegate void UserCallBack(String data);
@@ -58,10 +59,10 @@ namespace System.Diagnostics {
// Cache the last position scanned in sb when searching for lines.
private int currentLinePos;
#if MONO
//users to coordinate between Dispose and BeginReadLine
private object syncObject = new Object ();
//users to coordinate between Dispose and ReadBuffer
private object syncObject = new Object ();
private IAsyncResult asyncReadResult = null;
#endif
internal AsyncStreamReader(Process process, Stream stream, UserCallBack callback, Encoding encoding)
@@ -115,8 +116,31 @@ namespace System.Diagnostics {
lock (syncObject) {
#endif
if (disposing) {
if (stream != null)
if (stream != null) {
#if MONO
if (asyncReadResult != null && !asyncReadResult.IsCompleted) {
// Closing underlying stream when having pending async read request in progress is
// not portable and racy by design. Try to cancel pending async read before closing stream.
// We are still holding lock that will prevent new async read requests to queue up
// before we have closed and invalidated the stream.
if (stream is FileStream) {
SafeHandle tmpStreamHandle = ((FileStream)stream).SafeFileHandle;
while (!asyncReadResult.IsCompleted) {
MonoIOError error;
if (!MonoIO.Cancel (tmpStreamHandle, out error) && error == MonoIOError.ERROR_NOT_SUPPORTED) {
// Platform don't support canceling pending IO requests on stream. If an async pending read
// is still in flight when closing stream, it could trigger a race condition.
break;
}
// Wait for a short time for pending async read to cancel/complete/fail.
asyncReadResult.AsyncWaitHandle.WaitOne (200);
}
}
}
#endif
stream.Close();
}
}
if (stream != null) {
stream = null;
@@ -151,7 +175,11 @@ namespace System.Diagnostics {
if( sb == null ) {
sb = new StringBuilder(DefaultBufferSize);
#if MONO
asyncReadResult = stream.BeginRead (byteBuffer, 0 , byteBuffer.Length, new AsyncCallback (ReadBuffer), null);
#else
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
#endif
}
else {
FlushMessageQueue();
@@ -169,12 +197,17 @@ namespace System.Diagnostics {
try {
#if MONO
var stream = this.stream;
if (stream == null)
byteLen = 0;
else
#endif
lock (syncObject) {
Debug.Assert (ar.IsCompleted);
asyncReadResult = null;
if (this.stream == null)
byteLen = 0;
else
byteLen = stream.EndRead (ar);
}
#else
byteLen = stream.EndRead(ar);
#endif
}
catch (IOException ) {
// We should ideally consume errors from operations getting cancelled
@@ -242,10 +275,10 @@ retry_dispose:
byteLen = 0;
goto retry_dispose;
}
#endif
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
#if MONO
asyncReadResult = stream.BeginRead (byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
}
#else
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
#endif
}
}

View File

@@ -1 +1 @@
e1527546950d4297d8578925461d4b22d6a48737
7e5b7402c565fff530d672f65fbdb277fef199e2

View File

@@ -20,6 +20,7 @@ namespace System.Diagnostics {
using System.IO;
using System.ComponentModel.Design;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
@@ -38,7 +39,8 @@ namespace System.Diagnostics {
PermissionSet(SecurityAction.LinkDemand, Name="FullTrust"),
HostProtection(SharedState=true, SelfAffectingProcessMgmt=true)
]
public sealed partial class ProcessStartInfo {
[StructLayout (LayoutKind.Sequential)]
public sealed class ProcessStartInfo {
string fileName;
string arguments;
string directory;
@@ -66,6 +68,8 @@ namespace System.Diagnostics {
WeakReference weakParentProcess;
internal StringDictionary environmentVariables;
static readonly string [] empty = new string [0];
/// <devdoc>
/// Default constructor. At least the <see cref='System.Diagnostics.ProcessStartInfo.FileName'/>
/// property must be set before starting the process.
@@ -95,6 +99,17 @@ namespace System.Diagnostics {
this.arguments = arguments;
}
Collection<string> _argumentList;
public Collection<string> ArgumentList {
get {
if (_argumentList == null) {
_argumentList = new Collection<string>();
}
return _argumentList;
}
}
/// <devdoc>
/// <para>
/// Specifies the verb to use when opening the filename. For example, the "print"
@@ -459,5 +474,47 @@ namespace System.Diagnostics {
windowStyle = value;
}
}
internal bool HaveEnvVars {
get { return (environmentVariables != null); }
}
public Encoding StandardInputEncoding { get; set; }
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)]
public string[] Verbs {
get {
#if MOBILE
return empty;
#else
switch (System.Environment.OSVersion.Platform) {
case (PlatformID)4:
case (PlatformID)6:
case (PlatformID)128:
return empty; // no verb on non-Windows
default:
string ext = String.IsNullOrEmpty (fileName) ? null : Path.GetExtension (fileName);
if (ext == null)
return empty;
RegistryKey rk = null, rk2 = null, rk3 = null;
try {
rk = Registry.ClassesRoot.OpenSubKey (ext);
string k = rk != null ? rk.GetValue (null) as string : null;
rk2 = k != null ? Registry.ClassesRoot.OpenSubKey (k) : null;
rk3 = rk2 != null ? rk2.OpenSubKey ("shell") : null;
return rk3 != null ? rk3.GetSubKeyNames () : null;
} finally {
if (rk3 != null)
rk3.Close ();
if (rk2 != null)
rk2.Close ();
if (rk != null)
rk.Close ();
}
}
#endif
}
}
}
}

View File

@@ -136,10 +136,9 @@ namespace System {
#if !MONO
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern byte _GetByte(Array array, int index);
#if !MONO
[System.Security.SecuritySafeCritical] // auto-generated
public static byte GetByte(Array array, int index)
{
@@ -167,10 +166,9 @@ namespace System {
#if !MONO
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void _SetByte(Array array, int index, byte value);
#if !MONO
[System.Security.SecuritySafeCritical] // auto-generated
public static void SetByte(Array array, int index, byte value)
{

View File

@@ -49,15 +49,17 @@ namespace System.Collections.Generic
Contract.Ensures(Contract.Result<EqualityComparer<T>>() != null);
RuntimeType t = (RuntimeType)typeof(T);
// Specialize type byte for performance reasons
if (t == typeof(byte)) {
return (EqualityComparer<T>)(object)(new ByteEqualityComparer());
}
/////////////////////////////////////////////////
// KEEP THIS IN SYNC WITH THE DEVIRT CODE
// IN METHOD-TO-IR.C
/////////////////////////////////////////////////
// Specialize type byte for performance reasons
if (t == typeof(byte)) {
return (EqualityComparer<T>)(object)(new ByteEqualityComparer());
}
#if MOBILE
// Breaks .net serialization compatibility
if (t == typeof (string))

View File

@@ -186,7 +186,7 @@ namespace System.Globalization
// Abbreviated English Era Names are only used for the Japanese calendar.
if (!GlobalizationMode.Invariant && calendarId == (int)CalendarId.JAPAN)
{
this.saAbbrevEnglishEraNames = JapaneseCalendar.EnglishEraNames();
this.saAbbrevEnglishEraNames = GetJapaneseEnglishEraNames();
}
else
{
@@ -268,11 +268,7 @@ namespace System.Globalization
case CalendarId.JAPAN:
case CalendarId.JAPANESELUNISOLAR:
if (GlobalizationMode.Invariant)
{
throw new PlatformNotSupportedException();
}
this.saEraNames = JapaneseCalendar.EraNames();
this.saEraNames = GetJapaneseEraNames ();
break;
case CalendarId.PERSIAN:
@@ -289,6 +285,20 @@ namespace System.Globalization
}
}
private static string[] GetJapaneseEraNames()
{
if (GlobalizationMode.Invariant)
throw new PlatformNotSupportedException();
return JapaneseCalendar.EraNames();
}
private static string[] GetJapaneseEnglishEraNames()
{
if (GlobalizationMode.Invariant)
throw new PlatformNotSupportedException();
return JapaneseCalendar.EnglishEraNames();
}
private void InitializeAbbreviatedEraNames(string localeName, int calendarId)
{
// Note that the saAbbrevEraNames only include "AD" We don't have localized names for other calendars available from windows

View File

@@ -1 +1 @@
2a97f57ec17d27edda48c7cd045b23ed5d59212a
5184305c5aa6f525e12879708e6c4c71405ea9b4

View File

@@ -6,7 +6,6 @@
namespace System.Text
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime;
using System.Runtime.Remoting;
@@ -107,7 +106,7 @@ namespace System.Text
#if FEATURE_LATIN1
private static volatile Encoding latin1Encoding;
#endif
static volatile Hashtable encodings;
static volatile Dictionary<int, Encoding> encodings;
//
// The following values are from mlang.idl. These values
@@ -440,9 +439,8 @@ namespace System.Text
// Our Encoding
// See if we have a hash table with our encoding in it already.
if (encodings != null) {
result = (Encoding)encodings[codepage];
}
if (encodings != null)
encodings.TryGetValue (codepage, out result);
if (result == null)
{
@@ -451,12 +449,11 @@ namespace System.Text
{
// Need a new hash table
// in case another thread beat us to creating the Dictionary
if (encodings == null) {
encodings = new Hashtable();
}
if (encodings == null)
encodings = new Dictionary<int, Encoding> ();
// Double check that we don't have one in the table (in case another thread beat us here)
if ((result = (Encoding)encodings[codepage]) != null)
if (encodings.TryGetValue (codepage, out result))
return result;
// Special case the commonly used Encoding classes here, then call
@@ -552,8 +549,8 @@ namespace System.Text
break;
default:
result = (Encoding)(EncodingHelper.InvokeI18N ("GetEncoding", codepage));
if (result == null)
throw new NotSupportedException(string.Format("Encoding {0} data could not be found. Make sure you have correct international codeset assembly installed and enabled.", codepage));
if (result == null)
throw new NotSupportedException(string.Format("Encoding {0} data could not be found. Make sure you have correct international codeset assembly installed and enabled.", codepage));
break;
}
#else

View File

@@ -1316,11 +1316,7 @@ namespace System.Threading
{
// capture the sync context
if (0 == (options & CaptureOptions.IgnoreSyncCtx))
#if MONO
syncCtxNew = ecCurrent.SynchronizationContext;
#else
syncCtxNew = (ecCurrent.SynchronizationContext == null) ? null : ecCurrent.SynchronizationContext.CreateCopy();
#endif
#if FEATURE_REMOTING
// copy over the Logical Call Context