Skip to content

Commit 64659c0

Browse files
David EllingsworthDavid Ellingsworth
authored andcommitted
Do not call ConfigureAwait(false) from within the CustomSynchronizationContext.
1 parent 9b2fe0a commit 64659c0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/RestSharp/AsyncHelpers.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ public void Run() {
9797

9898
return;
9999

100+
// This method is only called from within this custom context for the initial task.
100101
async void PostCallback(object? _) {
101102
try {
102-
await _task().ConfigureAwait(false);
103+
// Do not call ConfigureAwait(false) here to ensure all continuations are
104+
// queued on this context, not the thread pool.
105+
await _task();
103106
}
104107
catch (Exception exception) {
105108
_caughtException = ExceptionDispatchInfo.Capture(exception);

0 commit comments

Comments
 (0)