Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2018-03-01 22:46:59 +0300
committerStephen Toub <stoub@microsoft.com>2018-03-02 01:14:55 +0300
commit1c2ba399d197f98d28b9c3e601dead3481ffd037 (patch)
tree31a53f285117705467ba3feb98ebacc68da1f366
parentd6fb9d46bcc46b25e3453077fd6a5e9cdd8c641a (diff)
Adjust corert's System.Private.CoreLib for Stream.WriteAsync change
-rw-r--r--src/System.Private.CoreLib/src/System/IO/Stream.cs8
-rw-r--r--src/System.Private.CoreLib/src/System/ThrowHelper.cs8
2 files changed, 11 insertions, 5 deletions
diff --git a/src/System.Private.CoreLib/src/System/IO/Stream.cs b/src/System.Private.CoreLib/src/System/IO/Stream.cs
index b4f8ab30d..154f10a6a 100644
--- a/src/System.Private.CoreLib/src/System/IO/Stream.cs
+++ b/src/System.Private.CoreLib/src/System/IO/Stream.cs
@@ -316,17 +316,17 @@ namespace System.IO
buffer, offset, count, this);
}
- public virtual Task WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
{
if (MemoryMarshal.TryGetArray(source, out ArraySegment<byte> array))
{
- return WriteAsync(array.Array, array.Offset, array.Count, cancellationToken);
+ return new ValueTask(WriteAsync(array.Array, array.Offset, array.Count, cancellationToken));
}
else
{
byte[] buffer = ArrayPool<byte>.Shared.Rent(source.Length);
source.Span.CopyTo(buffer);
- return FinishWriteAsync(WriteAsync(buffer, 0, source.Length, cancellationToken), buffer);
+ return new ValueTask(FinishWriteAsync(WriteAsync(buffer, 0, source.Length, cancellationToken), buffer));
async Task FinishWriteAsync(Task writeTask, byte[] localBuffer)
{
@@ -559,7 +559,7 @@ namespace System.IO
cancellationToken.ThrowIfCancellationRequested();
}
- public override async Task WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
+ public override async ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
}
diff --git a/src/System.Private.CoreLib/src/System/ThrowHelper.cs b/src/System.Private.CoreLib/src/System/ThrowHelper.cs
index 03c70becd..a3e3a0602 100644
--- a/src/System.Private.CoreLib/src/System/ThrowHelper.cs
+++ b/src/System.Private.CoreLib/src/System/ThrowHelper.cs
@@ -317,6 +317,10 @@ namespace System
return "comparer";
case ExceptionArgument.comparable:
return "comparable";
+ case ExceptionArgument.source:
+ return "source";
+ case ExceptionArgument.state:
+ return "state";
default:
Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum.");
return "";
@@ -408,7 +412,9 @@ namespace System
format,
culture,
comparer,
- comparable
+ comparable,
+ source,
+ state
}
//