Skip to content

Commit 1956718

Browse files
committed
ConfigureAwait(false)
1 parent 1a078d6 commit 1956718

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

WebApiClient/Contexts/ApiActionContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private async Task PrepareRequestAsync()
151151
}
152152
}
153153

154-
await apiAction.Return.Attribute.BeforeRequestAsync(this);
154+
await apiAction.Return.Attribute.BeforeRequestAsync(this).ConfigureAwait(false);
155155
}
156156

157157
/// <summary>

WebApiClient/HttpResponseFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public HttpResponseFile(HttpResponseMessage response)
5555
/// <returns></returns>
5656
public async Task SaveAsAsync(string filePath)
5757
{
58-
await this.SaveAsAsync(filePath, CancellationToken.None);
58+
await this.SaveAsAsync(filePath, CancellationToken.None).ConfigureAwait(false);
5959
}
6060

6161
/// <summary>

WebApiClient/Internal/Tasks/ApiRetryTask.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public IRetryTask<TResult> WhenCatchAsync<TException>(Func<TException, Task> han
139139
{
140140
if (handler != null)
141141
{
142-
await handler.Invoke(ex);
142+
await handler.Invoke(ex).ConfigureAwait(false);
143143
}
144144
return true;
145145
});
@@ -161,7 +161,7 @@ async Task<TResult> newInvoker()
161161
}
162162
catch (TException ex)
163163
{
164-
if (predicate == null || await predicate.Invoke(ex))
164+
if (predicate == null || await predicate.Invoke(ex).ConfigureAwait(false))
165165
{
166166
throw new RetryMarkException(ex);
167167
}
@@ -205,7 +205,7 @@ public IRetryTask<TResult> WhenResultAsync(Func<TResult, Task<bool>> predicate)
205205
async Task<TResult> newInvoker()
206206
{
207207
var result = await this.invoker.Invoke().ConfigureAwait(false);
208-
if (await predicate.Invoke(result) == true)
208+
if (await predicate.Invoke(result).ConfigureAwait(false) == true)
209209
{
210210
var inner = new ResultNotMatchException("结果不符合预期值", result);
211211
throw new RetryMarkException(inner);

0 commit comments

Comments
 (0)