Skip to content

Commit c0d66af

Browse files
authored
Clean up some custom awaiters (#48722)
Some appear to be dead code, others can be replaced by use of ConfigureAwaitOptions. I did not replace ones that appeared to be used by signalr client code as well, as that would have required ifdef'ing.
1 parent 467f896 commit c0d66af

File tree

8 files changed

+4
-161
lines changed

8 files changed

+4
-161
lines changed

src/Servers/Kestrel/Core/src/Internal/Infrastructure/ThreadPoolAwaitable.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ protected async Task InitializeConnectionAsync(RequestDelegate application, int
548548
InitializeConnectionWithoutPreface(application, addKestrelFeatures);
549549

550550
// Lose xUnit's AsyncTestSyncContext so middleware always runs inline for better determinism.
551-
await ThreadPoolAwaitable.Instance;
551+
await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding);
552552

553553
await SendPreambleAsync();
554554
await SendSettingsAsync();

src/SignalR/clients/csharp/Http.Connections.Client/src/Internal/TaskExtensions.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/SignalR/common/Http.Connections/src/Internal/HttpConnectionDispatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ private async Task ExecuteAsync(HttpContext context, ConnectionDelegate connecti
238238
// Wait for the transport to run
239239
// Ignore exceptions, it has been logged if there is one and the application has finished
240240
// So there is no one to give the exception to
241-
await connection.TransportTask!.NoThrow();
241+
await ((Task)connection.TransportTask!).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
242242

243243
// If the status code is a 204 it means the connection is done
244244
if (context.Response.StatusCode == StatusCodes.Status204NoContent)

src/SignalR/common/Http.Connections/src/Internal/TaskExtensions.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/SignalR/common/Shared/ForceAsyncAwaiter.cs

Lines changed: 0 additions & 75 deletions
This file was deleted.

src/SignalR/perf/Microbenchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<ItemGroup>
99
<Compile Include="$(SignalRSharedSourceRoot)BinaryMessageFormatter.cs" Link="BinaryMessageFormatter.cs" />
1010
<Compile Include="$(SignalRSharedSourceRoot)BinaryMessageParser.cs" Link="BinaryMessageParser.cs" />
11-
<Compile Include="$(SignalRSharedSourceRoot)ForceAsyncAwaiter.cs" Link="ForceAsyncAwaiter.cs" />
1211
<Compile Include="$(SignalRSharedSourceRoot)TextMessageFormatter.cs" Link="Internal\TextMessageFormatter.cs" />
1312
<Compile Include="$(SignalRSharedSourceRoot)TextMessageParser.cs" Link="Internal\TextMessageParser.cs" />
1413
<Compile Include="..\..\common\Http.Connections\src\ServerSentEventsMessageFormatter.cs" Link="ServerSentEventsMessageFormatter.cs" />

src/SignalR/perf/Microbenchmarks/Shared/TestPipeWriter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public override void Complete(Exception exception = null)
4848

4949
public async Task<FlushResult> ForceAsyncResult()
5050
{
51-
return await Task.FromResult<FlushResult>(default).ForceAsync();
51+
await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding);
52+
return default;
5253
}
5354
}

0 commit comments

Comments
 (0)