Suppress new compiler warnings
This commit is contained in:
Родитель
ad64bbdf9a
Коммит
4c0ab05753
|
@ -742,11 +742,13 @@ public abstract class AsyncEnumerableTests : TestBase, IAsyncLifetime
|
|||
{
|
||||
var asyncEnum = numbers.GetAsyncEnumerator(cancellationToken);
|
||||
await asyncEnum.MoveNextAsync();
|
||||
this.ArgEnumeratorAfterReturn = Task.Run(async delegate
|
||||
{
|
||||
await this.AllowEnumeratorToContinue.WaitAsync();
|
||||
await asyncEnum.MoveNextAsync();
|
||||
});
|
||||
this.ArgEnumeratorAfterReturn = Task.Run(
|
||||
async delegate
|
||||
{
|
||||
await this.AllowEnumeratorToContinue.WaitAsync();
|
||||
await asyncEnum.MoveNextAsync();
|
||||
},
|
||||
CancellationToken.None);
|
||||
}
|
||||
|
||||
public Task<CompoundEnumerableResult> GetNumbersAndMetadataAsync(CancellationToken cancellationToken)
|
||||
|
|
|
@ -144,7 +144,7 @@ public class CustomCancellationStrategyTests : TestBase
|
|||
var canceled = new AsyncManualResetEvent();
|
||||
using (cancellationToken.Register(canceled.Set))
|
||||
{
|
||||
await canceled.WaitAsync();
|
||||
await canceled.WaitAsync(CancellationToken.None);
|
||||
if (throwOnCanceled)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
|
|
@ -898,7 +898,7 @@ public abstract class DuplexPipeMarshalingTests : TestBase, IAsyncLifetime
|
|||
|
||||
public Task AcceptPipeAndChatLater(bool writeOnOdd, IDuplexPipe pipe, CancellationToken cancellationToken)
|
||||
{
|
||||
this.ChatLaterTask = Task.Run(() => this.TwoWayPipeAsArg(writeOnOdd, pipe, CancellationToken.None));
|
||||
this.ChatLaterTask = Task.Run(() => this.TwoWayPipeAsArg(writeOnOdd, pipe, CancellationToken.None), CancellationToken.None);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ public class JsonRpcJsonHeadersTests : JsonRpcTests
|
|||
protected override async ValueTask FlushAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
this.FlushEntered.Set();
|
||||
await this.AllowFlushAsyncExit.WaitAsync();
|
||||
await this.AllowFlushAsyncExit.WaitAsync(CancellationToken.None);
|
||||
await base.FlushAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -530,7 +530,7 @@ public class JsonRpcMessagePackLengthTests : JsonRpcTests
|
|||
protected override async ValueTask FlushAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
this.FlushEntered.Set();
|
||||
await this.AllowFlushAsyncExit.WaitAsync();
|
||||
await this.AllowFlushAsyncExit.WaitAsync(CancellationToken.None);
|
||||
await base.FlushAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -860,7 +860,7 @@ public class JsonRpcProxyGenerationTests : TestBase
|
|||
public async Task HeavyWorkAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
this.MethodEntered.Set();
|
||||
await this.ResumeMethod.WaitAsync().WithCancellation(cancellationToken);
|
||||
await this.ResumeMethod.WaitAsync(cancellationToken);
|
||||
this.Counter++;
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ public class JsonRpcProxyGenerationTests : TestBase
|
|||
{
|
||||
this.MethodEntered.Set();
|
||||
this.MethodResult.SetResult(param1);
|
||||
await this.ResumeMethod.WaitAsync().WithCancellation(cancellationToken);
|
||||
await this.ResumeMethod.WaitAsync(cancellationToken);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return param1;
|
||||
}
|
||||
|
@ -883,7 +883,7 @@ public class JsonRpcProxyGenerationTests : TestBase
|
|||
this.MethodEntered.Set();
|
||||
int sum = paramObject.Value<int>("a") + paramObject.Value<int>("b");
|
||||
this.MethodResult.SetResult(sum);
|
||||
await this.ResumeMethod.WaitAsync().WithCancellation(cancellationToken);
|
||||
await this.ResumeMethod.WaitAsync(cancellationToken);
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
|
|
@ -318,7 +318,15 @@ public abstract class JsonRpcRemoteTargetTests : InteropTestBase
|
|||
var retryIndex = 0;
|
||||
while (retryIndex < 100)
|
||||
{
|
||||
await Task.Delay(100);
|
||||
try
|
||||
{
|
||||
await Task.Delay(100, token);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (token.IsCancellationRequested)
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -83,7 +83,7 @@ public class JsonRpcSystemTextJsonHeadersTests : JsonRpcTests
|
|||
protected override async ValueTask FlushAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
this.FlushEntered.Set();
|
||||
await this.AllowFlushAsyncExit.WaitAsync();
|
||||
await this.AllowFlushAsyncExit.WaitAsync(CancellationToken.None);
|
||||
await base.FlushAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3611,7 +3611,7 @@ public abstract class JsonRpcTests : TestBase
|
|||
{
|
||||
var mres = new ManualResetEventSlim();
|
||||
cancellationToken.Register(() => mres.Set());
|
||||
mres.Wait();
|
||||
mres.Wait(CancellationToken.None);
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
@ -3666,7 +3666,7 @@ public abstract class JsonRpcTests : TestBase
|
|||
// TODO: remove when https://github.com/Microsoft/vs-threading/issues/185 is fixed
|
||||
if (this.DelayAsyncMethodWithCancellation)
|
||||
{
|
||||
await Task.Delay(UnexpectedTimeout).WithCancellation(cancellationToken);
|
||||
await Task.Delay(UnexpectedTimeout, cancellationToken);
|
||||
}
|
||||
|
||||
await this.AllowServerMethodToReturn.WaitAsync(cancellationToken);
|
||||
|
@ -3686,7 +3686,7 @@ public abstract class JsonRpcTests : TestBase
|
|||
public async Task<string> AsyncMethodIgnoresCancellation(string arg, CancellationToken cancellationToken)
|
||||
{
|
||||
this.ServerMethodReached.Set();
|
||||
await this.AllowServerMethodToReturn.WaitAsync();
|
||||
await this.AllowServerMethodToReturn.WaitAsync(CancellationToken.None);
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
var cancellationSignal = new AsyncManualResetEvent();
|
||||
|
@ -3706,7 +3706,7 @@ public abstract class JsonRpcTests : TestBase
|
|||
// TODO: remove when https://github.com/Microsoft/vs-threading/issues/185 is fixed
|
||||
if (this.DelayAsyncMethodWithCancellation)
|
||||
{
|
||||
await Task.Delay(UnexpectedTimeout).WithCancellation(cancellationToken);
|
||||
await Task.Delay(UnexpectedTimeout, cancellationToken);
|
||||
}
|
||||
|
||||
await this.AllowServerMethodToReturn.WaitAsync(cancellationToken);
|
||||
|
@ -3716,7 +3716,7 @@ public abstract class JsonRpcTests : TestBase
|
|||
public async Task<string> AsyncMethodFaultsAfterCancellation(string arg, CancellationToken cancellationToken)
|
||||
{
|
||||
this.ServerMethodReached.Set();
|
||||
await this.AllowServerMethodToReturn.WaitAsync();
|
||||
await this.AllowServerMethodToReturn.WaitAsync(CancellationToken.None);
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
var cancellationSignal = new AsyncManualResetEvent();
|
||||
|
|
|
@ -265,7 +265,7 @@ public class JsonRpcWithFatalExceptionsTests : TestBase
|
|||
// TODO: remove when https://github.com/Microsoft/vs-threading/issues/185 is fixed
|
||||
if (this.DelayAsyncMethodWithCancellation)
|
||||
{
|
||||
await Task.Delay(UnexpectedTimeout).WithCancellation(cancellationToken);
|
||||
await Task.Delay(UnexpectedTimeout, cancellationToken);
|
||||
}
|
||||
|
||||
await this.AllowServerMethodToReturn.WaitAsync(cancellationToken);
|
||||
|
@ -275,7 +275,7 @@ public class JsonRpcWithFatalExceptionsTests : TestBase
|
|||
public async Task<string> AsyncMethodFaultsAfterCancellation(string arg, CancellationToken cancellationToken)
|
||||
{
|
||||
this.ServerMethodReached.Set();
|
||||
await this.AllowServerMethodToReturn.WaitAsync();
|
||||
await this.AllowServerMethodToReturn.WaitAsync(CancellationToken.None);
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
var cancellationSignal = new AsyncManualResetEvent();
|
||||
|
|
|
@ -112,7 +112,11 @@ public class HttpClientMessageHandler : IJsonRpcMessageHandler
|
|||
{
|
||||
var response = await this.incomingMessages.DequeueAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
#if NET
|
||||
var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
#else
|
||||
var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
#endif
|
||||
using (var sequence = new Sequence<byte>())
|
||||
{
|
||||
var buffer = ArrayPool<byte>.Shared.Rent(4096);
|
||||
|
@ -121,7 +125,7 @@ public class HttpClientMessageHandler : IJsonRpcMessageHandler
|
|||
int bytesRead;
|
||||
while (true)
|
||||
{
|
||||
bytesRead = await responseStream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);
|
||||
bytesRead = await responseStream.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false);
|
||||
if (bytesRead == 0)
|
||||
{
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче