Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@@ -22,6 +22,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\external\winrt\winrt.depproj" />
<ProjectReference Include="..\..\mscorlib.WinRT-Facade\ref\mscorlib.WinRT-Facade.csproj" />
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
<ProjectReference Include="..\..\System.IO\ref\System.IO.csproj" />

View File

@@ -193,7 +193,7 @@ namespace System.IO
if (str == null)
{
ObjectDisposedException ex = new ObjectDisposedException(SR.ObjectDisposed_CannotPerformOperation);
ex.SetErrorCode(HResults.RO_E_CLOSED);
ex.SetErrorCode(__HResults.RO_E_CLOSED);
throw ex;
}
@@ -234,14 +234,14 @@ namespace System.IO
if (count < 0 || Int32.MaxValue < count)
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException(nameof(count));
ex.SetErrorCode(HResults.E_INVALIDARG);
ex.SetErrorCode(__HResults.E_INVALIDARG);
throw ex;
}
if (buffer.Capacity < count)
{
ArgumentException ex = new ArgumentException(SR.Argument_InsufficientBufferCapacity);
ex.SetErrorCode(HResults.E_INVALIDARG);
ex.SetErrorCode(__HResults.E_INVALIDARG);
throw ex;
}
@@ -249,7 +249,7 @@ namespace System.IO
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException(nameof(options),
SR.ArgumentOutOfRange_InvalidInputStreamOptionsEnumValue);
ex.SetErrorCode(HResults.E_INVALIDARG);
ex.SetErrorCode(__HResults.E_INVALIDARG);
throw ex;
}
@@ -300,7 +300,7 @@ namespace System.IO
if (buffer.Capacity < buffer.Length)
{
ArgumentException ex = new ArgumentException(SR.Argument_BufferLengthExceedsCapacity);
ex.SetErrorCode(HResults.E_INVALIDARG);
ex.SetErrorCode(__HResults.E_INVALIDARG);
throw ex;
}
@@ -335,7 +335,7 @@ namespace System.IO
if (position > Int64.MaxValue)
{
ArgumentException ex = new ArgumentException(SR.IO_CannotSeekBeyondInt64MaxValue);
ex.SetErrorCode(HResults.E_INVALIDARG);
ex.SetErrorCode(__HResults.E_INVALIDARG);
throw ex;
}
@@ -400,7 +400,7 @@ namespace System.IO
if (value > Int64.MaxValue)
{
ArgumentException ex = new ArgumentException(SR.IO_CannotSetSizeBeyondInt64MaxValue);
ex.SetErrorCode(HResults.E_INVALIDARG);
ex.SetErrorCode(__HResults.E_INVALIDARG);
throw ex;
}
@@ -412,7 +412,7 @@ namespace System.IO
if (!str.CanWrite)
{
InvalidOperationException ex = new InvalidOperationException(SR.InvalidOperation_CannotSetStreamSizeCannotWrite);
ex.SetErrorCode(HResults.E_ILLEGAL_METHOD_CALL);
ex.SetErrorCode(__HResults.E_ILLEGAL_METHOD_CALL);
throw ex;
}
@@ -441,7 +441,7 @@ namespace System.IO
private static void ThrowCloningNotSupported(String methodName)
{
NotSupportedException nse = new NotSupportedException(SR.Format(SR.NotSupported_CloningNotSupported, methodName));
nse.SetErrorCode(HResults.E_NOTIMPL);
nse.SetErrorCode(__HResults.E_NOTIMPL);
throw nse;
}

View File

@@ -18,7 +18,7 @@ namespace System.IO
/// we want the <c>ReadAsync</c> / <c>WriteAsync</c> / <c>FlushAsync</c> / etc. operation to be implemented
/// differently. This is for best performance as we can take advantage of the specifics of particular stream
/// types. For instance, <c>ReadAsync</c> currently has a special implementation for memory streams.
/// Moreover, knowledge about the actual runtime type of the <c>IBuffer</c> can also help chosing the optimal
/// Moreover, knowledge about the actual runtime type of the <c>IBuffer</c> can also help choosing the optimal
/// implementation. This type provides static methods that encapsulate the performance logic and can be used
/// by <c>NetFxToWinRtStreamAdapter</c>.</summary>
internal static class StreamOperationsImplementation

View File

@@ -9,7 +9,7 @@ namespace System.Runtime.InteropServices
/// <summary>
/// HRESULT values used in this assembly.
/// </summary>
internal static class HResults
internal static class __HResults
{
internal const Int32 S_OK = unchecked((Int32)0x00000000);
internal const Int32 E_BOUNDS = unchecked((Int32)0x8000000B);

View File

@@ -182,7 +182,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void CollectionChanged.add(NotifyCollectionChangedEventHandler)
add
{
INotifyCollectionChanged_WinRT _this = JitHelpers.UnsafeCast<INotifyCollectionChanged_WinRT>(this);
INotifyCollectionChanged_WinRT _this = Unsafe.As<INotifyCollectionChanged_WinRT>(this);
// call the WinRT eventing support in mscorlib to subscribe the event
Func<NotifyCollectionChangedEventHandler, EventRegistrationToken> addMethod =
@@ -196,7 +196,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void CollectionChanged.remove(NotifyCollectionChangedEventHandler)
remove
{
INotifyCollectionChanged_WinRT _this = JitHelpers.UnsafeCast<INotifyCollectionChanged_WinRT>(this);
INotifyCollectionChanged_WinRT _this = Unsafe.As<INotifyCollectionChanged_WinRT>(this);
// call the WinRT eventing support in mscorlib to unsubscribe the event
Action<EventRegistrationToken> removeMethod =
@@ -226,7 +226,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// EventRegistrationToken CollectionChanged.add(NotifyCollectionChangedEventHandler value)
internal EventRegistrationToken add_CollectionChanged(NotifyCollectionChangedEventHandler value)
{
INotifyCollectionChanged _this = JitHelpers.UnsafeCast<INotifyCollectionChanged>(this);
INotifyCollectionChanged _this = Unsafe.As<INotifyCollectionChanged>(this);
EventRegistrationTokenTable<NotifyCollectionChangedEventHandler> table = s_weakTable.GetOrCreateValue(_this);
EventRegistrationToken token = table.AddEventHandler(value);
@@ -238,7 +238,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void CollectionChanged.remove(EventRegistrationToken token)
internal void remove_CollectionChanged(EventRegistrationToken token)
{
INotifyCollectionChanged _this = JitHelpers.UnsafeCast<INotifyCollectionChanged>(this);
INotifyCollectionChanged _this = Unsafe.As<INotifyCollectionChanged>(this);
EventRegistrationTokenTable<NotifyCollectionChangedEventHandler> table = s_weakTable.GetOrCreateValue(_this);
NotifyCollectionChangedEventHandler handler = table.ExtractHandler(token);
@@ -264,7 +264,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void PropertyChanged.add(PropertyChangedEventHandler)
add
{
INotifyPropertyChanged_WinRT _this = JitHelpers.UnsafeCast<INotifyPropertyChanged_WinRT>(this);
INotifyPropertyChanged_WinRT _this = Unsafe.As<INotifyPropertyChanged_WinRT>(this);
// call the WinRT eventing support in mscorlib to subscribe the event
Func<PropertyChangedEventHandler, EventRegistrationToken> addMethod =
@@ -278,7 +278,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void PropertyChanged.remove(PropertyChangedEventHandler)
remove
{
INotifyPropertyChanged_WinRT _this = JitHelpers.UnsafeCast<INotifyPropertyChanged_WinRT>(this);
INotifyPropertyChanged_WinRT _this = Unsafe.As<INotifyPropertyChanged_WinRT>(this);
// call the WinRT eventing support in mscorlib to unsubscribe the event
Action<EventRegistrationToken> removeMethod =
@@ -308,7 +308,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// EventRegistrationToken PropertyChanged.add(PropertyChangedEventHandler value)
internal EventRegistrationToken add_PropertyChanged(PropertyChangedEventHandler value)
{
INotifyPropertyChanged _this = JitHelpers.UnsafeCast<INotifyPropertyChanged>(this);
INotifyPropertyChanged _this = Unsafe.As<INotifyPropertyChanged>(this);
EventRegistrationTokenTable<PropertyChangedEventHandler> table = s_weakTable.GetOrCreateValue(_this);
EventRegistrationToken token = table.AddEventHandler(value);
@@ -320,7 +320,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void PropertyChanged.remove(EventRegistrationToken token)
internal void remove_PropertyChanged(EventRegistrationToken token)
{
INotifyPropertyChanged _this = JitHelpers.UnsafeCast<INotifyPropertyChanged>(this);
INotifyPropertyChanged _this = Unsafe.As<INotifyPropertyChanged>(this);
EventRegistrationTokenTable<PropertyChangedEventHandler> table = s_weakTable.GetOrCreateValue(_this);
PropertyChangedEventHandler handler = table.ExtractHandler(token);
@@ -350,7 +350,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void CanExecuteChanged.add(EventHandler)
add
{
ICommand_WinRT _this = JitHelpers.UnsafeCast<ICommand_WinRT>(this);
ICommand_WinRT _this = Unsafe.As<ICommand_WinRT>(this);
// call the WinRT eventing support in mscorlib to subscribe the event
Func<EventHandler<object>, EventRegistrationToken> addMethod =
@@ -367,7 +367,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void CanExecuteChanged.remove(EventHandler)
remove
{
ICommand_WinRT _this = JitHelpers.UnsafeCast<ICommand_WinRT>(this);
ICommand_WinRT _this = Unsafe.As<ICommand_WinRT>(this);
// call the WinRT eventing support in mscorlib to unsubscribe the event
Action<EventRegistrationToken> removeMethod =
@@ -384,13 +384,13 @@ namespace System.Runtime.InteropServices.WindowsRuntime
private bool CanExecute(object parameter)
{
ICommand_WinRT _this = JitHelpers.UnsafeCast<ICommand_WinRT>(this);
ICommand_WinRT _this = Unsafe.As<ICommand_WinRT>(this);
return _this.CanExecute(parameter);
}
private void Execute(object parameter)
{
ICommand_WinRT _this = JitHelpers.UnsafeCast<ICommand_WinRT>(this);
ICommand_WinRT _this = Unsafe.As<ICommand_WinRT>(this);
_this.Execute(parameter);
}
}
@@ -415,7 +415,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// EventRegistrationToken PropertyChanged.add(EventHandler<object> value)
private EventRegistrationToken add_CanExecuteChanged(EventHandler<object> value)
{
ICommand _this = JitHelpers.UnsafeCast<ICommand>(this);
ICommand _this = Unsafe.As<ICommand>(this);
EventRegistrationTokenTable<EventHandler> table = s_weakTable.GetOrCreateValue(_this);
EventHandler handler = ICommandAdapterHelpers.CreateWrapperHandler(value);
@@ -428,7 +428,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// void PropertyChanged.remove(EventRegistrationToken token)
private void remove_CanExecuteChanged(EventRegistrationToken token)
{
ICommand _this = JitHelpers.UnsafeCast<ICommand>(this);
ICommand _this = Unsafe.As<ICommand>(this);
EventRegistrationTokenTable<EventHandler> table = s_weakTable.GetOrCreateValue(_this);
EventHandler handler = table.ExtractHandler(token);
@@ -440,13 +440,13 @@ namespace System.Runtime.InteropServices.WindowsRuntime
private bool CanExecute(object parameter)
{
ICommand _this = JitHelpers.UnsafeCast<ICommand>(this);
ICommand _this = Unsafe.As<ICommand>(this);
return _this.CanExecute(parameter);
}
private void Execute(object parameter)
{
ICommand _this = JitHelpers.UnsafeCast<ICommand>(this);
ICommand _this = Unsafe.As<ICommand>(this);
_this.Execute(parameter);
}
}

View File

@@ -89,7 +89,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
Int32 hr = Interop.mincore.RoGetBufferMarshaler(out proxy);
t_winRtMarshalProxy = proxy;
if (hr != HResults.S_OK)
if (hr != __HResults.S_OK)
{
Exception ex = new Exception(String.Format("{0} ({1}!RoGetBufferMarshaler)", SR.WinRtCOM_Error, WinTypesDLL));
ex.SetErrorCode(hr);
@@ -242,7 +242,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (value > ((IBuffer)this).Capacity)
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException(nameof(value), SR.Argument_BufferLengthExceedsCapacity);
ex.SetErrorCode(HResults.E_BOUNDS);
ex.SetErrorCode(__HResults.E_BOUNDS);
throw ex;
}

View File

@@ -12,7 +12,7 @@ using Windows.Storage.Streams;
namespace System.Runtime.InteropServices.WindowsRuntime
{
/// <summary>
/// Contains a extension methods that expose operations on WinRT <code>Windows.Foundation.IBuffer</code>.
/// Contains extension methods that expose operations on WinRT <code>Windows.Foundation.IBuffer</code>.
/// </summary>
public static class WindowsRuntimeBufferExtensions
{
@@ -309,7 +309,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
/// <summary>
/// Checks if the underlying memory backing two <code>IBuffer</code> intances is actually the same memory.
/// Checks if the underlying memory backing two <code>IBuffer</code> instances is actually the same memory.
/// When applied to <code>IBuffer</code> instances backed by managed arrays this method is preferable to a naive comparison
/// (such as <code>((IBufferByteAccess) buffer).Buffer == ((IBufferByteAccess) otherBuffer).Buffer</code>) because it avoids
/// pinning the backing array which would be necessary if a direct memory pointer was obtained.

View File

@@ -20,7 +20,7 @@ namespace System.Threading.Tasks
/// <summary>
/// We want to avoid ending up with the same ID as a Windows-implemented async info.
/// At the same time we want to be reproducable. So we use a random generator with a fixed seed.
/// At the same time we want to be reproducible. So we use a random generator with a fixed seed.
/// </summary>
private static Random s_idGenerator = new Random(19830118);
@@ -44,7 +44,7 @@ namespace System.Threading.Tasks
/// Initialises the specified <code>id</code> to a unique Id-value that can be used for an IAsyncInfo object under the
/// assumption that another thread may also attempt to initialise <code>id</code>. The thread that changes <code>id</code>
/// first from <code>AsyncInfoIdGenerator.InvalidId</code> to another value wins and all other threads will respect that
/// choice and leave <code>id</code> unchanged. The method returns the Id that was ageed upon by the race.
/// choice and leave <code>id</code> unchanged. The method returns the Id that was agreed upon by the race.
/// </summary>
/// <param name="id">The IAsyncInfo ID to initialise.</param>
/// <returns>The unique value to which the specified reference target was initialised.</returns>

View File

@@ -77,7 +77,7 @@ namespace System.Threading.Tasks
InvalidOperationException ex = (cause == null)
? new InvalidOperationException(SR.InvalidOperation_CannotGetResultsFromIncompleteOperation)
: new InvalidOperationException(SR.InvalidOperation_CannotGetResultsFromIncompleteOperation, cause);
ex.SetErrorCode(HResults.E_ILLEGAL_METHOD_CALL);
ex.SetErrorCode(__HResults.E_ILLEGAL_METHOD_CALL);
return ex;
}
@@ -92,7 +92,7 @@ namespace System.Threading.Tasks
/// <summary>The async info's ID. InvalidAsyncId stands for not yet been initialised.</summary>
private UInt32 _id = AsyncInfoIdGenerator.InvalidId;
/// <summary>The cached error code used to avoid creatung several exception objects if the <code>ErrorCode</code>
/// <summary>The cached error code used to avoid creating several exception objects if the <code>ErrorCode</code>
/// property is accessed several times. <code>null</code> indicates either no error or that <code>ErrorCode</code>
/// has not yet been called.</summary>
private Exception _error = null;
@@ -100,7 +100,7 @@ namespace System.Threading.Tasks
/// <summary>The state of the async info. Interlocked operations are used to manipulate this field.</summary>
private volatile Int32 _state = STATE_NOT_INITIALIZED;
/// <summary>For IAsyncInfo intances that completed synchronously (at creation time) this field holds the result;
/// <summary>For IAsyncInfo instances that completed synchronously (at creation time) this field holds the result;
/// for instances backed by an actual Task, this field holds a reference to the task generated by the task generator.
/// Since we always know which of the above is the case, we can always cast this field to TResult in the former case
/// or to one of Task or Task{TResult} in the latter case. This approach allows us to save a field on all IAsyncInfos.
@@ -114,7 +114,7 @@ namespace System.Threading.Tasks
/// <summary>Registered progress handler.</summary>
private TProgressHandler _progressHandler;
/// <summary>The synchronization context on which this instance was created/started. Used to callback invokations.</summary>
/// <summary>The synchronization context on which this instance was created/started. Used to callback invocations.</summary>
private SynchronizationContext _startingContext;
#endregion Instance variables
@@ -397,7 +397,7 @@ namespace System.Threading.Tasks
return;
ObjectDisposedException ex = new ObjectDisposedException(SR.ObjectDisposed_AsyncInfoIsClosed);
ex.SetErrorCode(HResults.E_ILLEGAL_METHOD_CALL);
ex.SetErrorCode(__HResults.E_ILLEGAL_METHOD_CALL);
throw ex;
}
@@ -857,7 +857,7 @@ namespace System.Threading.Tasks
if (handlerBefore != null)
{
InvalidOperationException ex = new InvalidOperationException(SR.InvalidOperation_CannotSetCompletionHanlderMoreThanOnce);
ex.SetErrorCode(HResults.E_ILLEGAL_DELEGATE_ASSIGNMENT);
ex.SetErrorCode(__HResults.E_ILLEGAL_DELEGATE_ASSIGNMENT);
throw ex;
}
@@ -940,7 +940,7 @@ namespace System.Threading.Tasks
if (0 != (_state & STATEMASK_SELECT_ANY_ASYNC_STATE))
{
InvalidOperationException ex = new InvalidOperationException(SR.InvalidOperation_IllegalStateChange);
ex.SetErrorCode(HResults.E_ILLEGAL_STATE_CHANGE);
ex.SetErrorCode(__HResults.E_ILLEGAL_STATE_CHANGE);
throw ex;
}
}
@@ -981,7 +981,7 @@ namespace System.Threading.Tasks
if (aggregateException == null)
{
error = new Exception(SR.WinRtCOM_Error);
error.SetErrorCode(HResults.E_FAIL);
error.SetErrorCode(__HResults.E_FAIL);
}
else
{

View File

@@ -188,7 +188,7 @@ namespace System.IO
// asyncReadOp.Id in a progress callback must match the ID of the asyncReadOp to which the callback was assigned
Assert.Equal(readOpId, asyncReadOp.Id);
// asyncReadOp.Status must be 'Started' for a asyncReadOp in progress
// asyncReadOp.Status must be 'Started' for an asyncReadOp in progress
Assert.Equal(AsyncStatus.Started, asyncReadOp.Status);
// bytesCompleted must be in range [0, maxBytesToRead] asyncReadOp in progress
@@ -322,7 +322,7 @@ namespace System.IO
// asyncWriteOp.Id in a progress callback must match the ID of the asyncWriteOp to which the callback was assigned
Assert.Equal(writeOpId, asyncWriteOp.Id);
// asyncWriteOp.Status must be 'Started' for a asyncWriteOp in progress
// asyncWriteOp.Status must be 'Started' for an asyncWriteOp in progress
Assert.Equal(AsyncStatus.Started, asyncWriteOp.Status);
// bytesCompleted must be in range [0, maxBytesToWrite] asyncWriteOp in progress