@@ -204,7 +204,7 @@ public async Task StartAsync(TransferFormat transferFormat, CancellationToken ca
204204 {
205205 using ( _logger . BeginScope ( _logScope ) )
206206 {
207- await StartAsyncCore ( transferFormat , cancellationToken ) ;
207+ await StartAsyncCore ( transferFormat , cancellationToken ) . ConfigureAwait ( false ) ;
208208 }
209209 }
210210
@@ -218,7 +218,7 @@ private async Task StartAsyncCore(TransferFormat transferFormat, CancellationTok
218218 return ;
219219 }
220220
221- await _connectionLock . WaitAsync ( cancellationToken ) ;
221+ await _connectionLock . WaitAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
222222 try
223223 {
224224 CheckDisposed ( ) ;
@@ -231,7 +231,7 @@ private async Task StartAsyncCore(TransferFormat transferFormat, CancellationTok
231231
232232 Log . Starting ( _logger ) ;
233233
234- await SelectAndStartTransport ( transferFormat , cancellationToken ) ;
234+ await SelectAndStartTransport ( transferFormat , cancellationToken ) . ConfigureAwait ( false ) ;
235235
236236 _started = true ;
237237 Log . Started ( _logger ) ;
@@ -254,7 +254,7 @@ public override async ValueTask DisposeAsync()
254254 {
255255 using ( _logger . BeginScope ( _logScope ) )
256256 {
257- await DisposeAsyncCore ( ) ;
257+ await DisposeAsyncCore ( ) . ConfigureAwait ( false ) ;
258258 }
259259 }
260260
@@ -265,7 +265,7 @@ private async Task DisposeAsyncCore()
265265 return ;
266266 }
267267
268- await _connectionLock . WaitAsync ( ) ;
268+ await _connectionLock . WaitAsync ( ) . ConfigureAwait ( false ) ;
269269 try
270270 {
271271 if ( ! _disposed && _started )
@@ -276,7 +276,7 @@ private async Task DisposeAsyncCore()
276276 // The transport should also have completed the pipe with this exception.
277277 try
278278 {
279- await _transport ! . StopAsync ( ) ;
279+ await _transport ! . StopAsync ( ) . ConfigureAwait ( false ) ;
280280 }
281281 catch ( Exception ex )
282282 {
@@ -317,7 +317,7 @@ private async Task SelectAndStartTransport(TransferFormat transferFormat, Cancel
317317 if ( _httpConnectionOptions . Transports == HttpTransportType . WebSockets )
318318 {
319319 Log . StartingTransport ( _logger , _httpConnectionOptions . Transports , uri ) ;
320- await StartTransport ( uri , _httpConnectionOptions . Transports , transferFormat , cancellationToken ) ;
320+ await StartTransport ( uri , _httpConnectionOptions . Transports , transferFormat , cancellationToken ) . ConfigureAwait ( false ) ;
321321 }
322322 else
323323 {
@@ -331,7 +331,7 @@ private async Task SelectAndStartTransport(TransferFormat transferFormat, Cancel
331331
332332 do
333333 {
334- negotiationResponse = await GetNegotiationResponseAsync ( uri , cancellationToken ) ;
334+ negotiationResponse = await GetNegotiationResponseAsync ( uri , cancellationToken ) . ConfigureAwait ( false ) ;
335335
336336 if ( negotiationResponse . Url != null )
337337 {
@@ -402,12 +402,12 @@ private async Task SelectAndStartTransport(TransferFormat transferFormat, Cancel
402402 // The negotiation response gets cleared in the fallback scenario.
403403 if ( negotiationResponse == null )
404404 {
405- negotiationResponse = await GetNegotiationResponseAsync ( uri , cancellationToken ) ;
405+ negotiationResponse = await GetNegotiationResponseAsync ( uri , cancellationToken ) . ConfigureAwait ( false ) ;
406406 connectUrl = CreateConnectUrl ( uri , negotiationResponse . ConnectionToken ) ;
407407 }
408408
409409 Log . StartingTransport ( _logger , transportType , uri ) ;
410- await StartTransport ( connectUrl , transportType , transferFormat , cancellationToken ) ;
410+ await StartTransport ( connectUrl , transportType , transferFormat , cancellationToken ) . ConfigureAwait ( false ) ;
411411 break ;
412412 }
413413 }
@@ -468,11 +468,11 @@ private async Task<NegotiationResponse> NegotiateAsync(Uri url, HttpClient httpC
468468 // rather than buffer the entire response. This gives a small perf boost.
469469 // Note that it is important to dispose of the response when doing this to
470470 // avoid leaving the connection open.
471- using ( var response = await httpClient . SendAsync ( request , HttpCompletionOption . ResponseHeadersRead , cancellationToken ) )
471+ using ( var response = await httpClient . SendAsync ( request , HttpCompletionOption . ResponseHeadersRead , cancellationToken ) . ConfigureAwait ( false ) )
472472 {
473473 response . EnsureSuccessStatusCode ( ) ;
474474#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods
475- var responseBuffer = await response . Content . ReadAsByteArrayAsync ( ) ;
475+ var responseBuffer = await response . Content . ReadAsByteArrayAsync ( ) . ConfigureAwait ( false ) ;
476476#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods
477477 var negotiateResponse = NegotiateProtocol . ParseResponse ( responseBuffer ) ;
478478 if ( ! string . IsNullOrEmpty ( negotiateResponse . Error ) )
@@ -509,7 +509,7 @@ private async Task StartTransport(Uri connectUrl, HttpTransportType transportTyp
509509 // Start the transport, giving it one end of the pipe
510510 try
511511 {
512- await transport . StartAsync ( connectUrl , transferFormat , cancellationToken ) ;
512+ await transport . StartAsync ( connectUrl , transferFormat , cancellationToken ) . ConfigureAwait ( false ) ;
513513 }
514514 catch ( Exception ex )
515515 {
@@ -683,7 +683,7 @@ private static bool IsWebSocketsSupported()
683683
684684 private async Task < NegotiationResponse > GetNegotiationResponseAsync ( Uri uri , CancellationToken cancellationToken )
685685 {
686- var negotiationResponse = await NegotiateAsync ( uri , _httpClient ! , _logger , cancellationToken ) ;
686+ var negotiationResponse = await NegotiateAsync ( uri , _httpClient ! , _logger , cancellationToken ) . ConfigureAwait ( false ) ;
687687 // If the negotiationVersion is greater than zero then we know that the negotiation response contains a
688688 // connectionToken that will be required to conenct. Otherwise we just set the connectionId and the
689689 // connectionToken on the client to the same value.
0 commit comments