提交 53be1891 编写于 作者: T Tom Meschter

Simplify call to Task.Run

We don't need to await the call to `ConnectAsync` in the async lambda passed to `Task.Run`. Instead we can just have a lambda that returns the same `Task` returned by `ConnectAsync` and `Task.Run` will do the right thing.
上级 6aa5c78b
......@@ -345,7 +345,7 @@ internal static bool IsCompilerServerSupported(string tempPath)
// To avoid this, we first force ourselves to a background thread using Task.Run.
// This ensures that the Task created by ConnectAsync will run on the default
// TaskScheduler (i.e., on a threadpool thread) which was the intent all along.
await Task.Run(async () => await pipeStream.ConnectAsync(timeoutMs, cancellationToken).ConfigureAwait(false)).ConfigureAwait(false);
await Task.Run(() => pipeStream.ConnectAsync(timeoutMs, cancellationToken)).ConfigureAwait(false);
}
catch (Exception e) when (e is IOException || e is TimeoutException)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册