Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public override int Read(byte[] buffer, int offset, int count)
/// </returns>
public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
int result = await this.CryptoStream.ReadAsync(buffer, offset, count, cancellationToken);
int result = await this.CryptoStream.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
return result;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void RunSync(Func<Task> workItem)
{
try
{
await workItem();
await workItem().ConfigureAwait(false);
}
catch (Exception e)
{
Expand Down Expand Up @@ -58,7 +58,7 @@ public static T RunSync<T>(Func<Task<T>> workItem)
{
try
{
ret = await workItem();
ret = await workItem().ConfigureAwait(false);
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/Core/Amazon.Runtime/Internal/_async/AsyncRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static Task<T> Run<T>(Func<T> action, CancellationToken cancellationToken
#endif
{
thread.Start();
await semaphore.WaitAsync();
await semaphore.WaitAsync().ConfigureAwait(false);
thread.Join();

if (exception != null)
Expand Down
12 changes: 6 additions & 6 deletions sdk/src/Core/Amazon.Runtime/Pipeline/HttpHandler/HttpHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public override async System.Threading.Tasks.Task<T> InvokeAsync<T>(IExecutionCo
// where the stream is a property of the request.
#if BCL45
var requestContent = await httpRequest.GetRequestContentAsync(executionContext.RequestContext.CancellationToken).ConfigureAwait(false);
await WriteContentToRequestBodyAsync(requestContent, httpRequest, executionContext.RequestContext);
await WriteContentToRequestBodyAsync(requestContent, httpRequest, executionContext.RequestContext).ConfigureAwait(false);
#else
var requestContent = await httpRequest.GetRequestContentAsync().ConfigureAwait(false);
WriteContentToRequestBody(requestContent, httpRequest, executionContext.RequestContext);
Expand All @@ -181,8 +181,8 @@ public override async System.Threading.Tasks.Task<T> InvokeAsync<T>(IExecutionCo
}

var response = await httpRequest.GetResponseAsync(executionContext.RequestContext.CancellationToken).
ConfigureAwait(false);
executionContext.ResponseContext.HttpResponse = response;
ConfigureAwait(false);
executionContext.ResponseContext.HttpResponse = response;
}
// The response is not unmarshalled yet.
return null;
Expand Down Expand Up @@ -439,15 +439,15 @@ private async System.Threading.Tasks.Task WriteContentToRequestBodyAsync(TReques
{
byte[] requestData = wrappedRequest.Content;
requestContext.Metrics.AddProperty(Metric.RequestSize, requestData.Length);
await httpRequest.WriteToRequestBodyAsync(requestContent, requestData, requestContext.Request.Headers, requestContext.CancellationToken);
await httpRequest.WriteToRequestBodyAsync(requestContent, requestData, requestContext.Request.Headers, requestContext.CancellationToken).ConfigureAwait(false);
}
else
{
System.IO.Stream originalStream;
if (wrappedRequest.ContentStream == null)
{
originalStream = new System.IO.MemoryStream();
await originalStream.WriteAsync(wrappedRequest.Content, 0, wrappedRequest.Content.Length, requestContext.CancellationToken);
await originalStream.WriteAsync(wrappedRequest.Content, 0, wrappedRequest.Content.Length, requestContext.CancellationToken).ConfigureAwait(false);
originalStream.Position = 0;
}
else
Expand All @@ -460,7 +460,7 @@ private async System.Threading.Tasks.Task WriteContentToRequestBodyAsync(TReques
originalStream = httpRequest.SetupProgressListeners(originalStream, requestContext.ClientConfig.ProgressUpdateInterval, this.CallbackSender, callback);
var inputStream = GetInputStream(requestContext, originalStream, wrappedRequest);
await httpRequest.WriteToRequestBodyAsync(requestContent, inputStream,
requestContext.Request.Headers, requestContext);
requestContext.Request.Headers, requestContext).ConfigureAwait(false);

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ public async Task WriteToRequestBodyAsync(Stream requestContent, Stream contentS
int bytesRead = 0;
int bytesToRead = buffer.Length;

while ((bytesRead = await contentStream.ReadAsync(buffer, 0, bytesToRead, requestContext.CancellationToken)) > 0)
while ((bytesRead = await contentStream.ReadAsync(buffer, 0, bytesToRead, requestContext.CancellationToken).ConfigureAwait(false)) > 0)
{
requestContext.CancellationToken.ThrowIfCancellationRequested();
await requestContent.WriteAsync(buffer, 0, bytesRead, requestContext.CancellationToken);
await requestContent.WriteAsync(buffer, 0, bytesRead, requestContext.CancellationToken).ConfigureAwait(false);
}
}
catch
Expand Down Expand Up @@ -327,7 +327,7 @@ public async Task WriteToRequestBodyAsync(Stream requestContent, Stream contentS
cancellationToken.ThrowIfCancellationRequested();
using (requestContent)
{
await requestContent.WriteAsync(content, 0, content.Length, cancellationToken);
await requestContent.WriteAsync(content, 0, content.Length, cancellationToken).ConfigureAwait(false);
}
}

Expand All @@ -337,7 +337,7 @@ public async Task WriteToRequestBodyAsync(Stream requestContent, Stream contentS
/// <returns></returns>
public async Task<Stream> GetRequestContentAsync()
{
return await GetRequestContentAsync(CancellationToken.None);
return await GetRequestContentAsync(CancellationToken.None).ConfigureAwait(false);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static async Task<ProcessExecutionResult> RunProcessAsync(ProcessStartInf
var standardErrorTask = process.StandardError.ReadToEndAsync();
var standardOutputTask = process.StandardOutput.ReadToEndAsync();

await Task.WhenAll(tcs.Task, standardErrorTask, standardOutputTask);
await Task.WhenAll(tcs.Task, standardErrorTask, standardOutputTask).ConfigureAwait(false);

return new ProcessExecutionResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public async Task<List<Tuple<string, IEnumerable<string>, HttpStatusCode>>> GetR
HttpMethod httpMethod = new HttpMethod(httpMethodValue);
var headers = new List<Tuple<string, IEnumerable<string>, HttpStatusCode>>();
var request = new HttpRequestMessage(httpMethod, url);
var response = await _httpClient.SendAsync(request);
var response = await _httpClient.SendAsync(request).ConfigureAwait(false);
foreach (var header in response.Headers)
{
headers.Add(new Tuple<string, IEnumerable<string>, HttpStatusCode>(header.Key, header.Value, response.StatusCode));
Expand Down