-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ConfigureAwait(false) when enumerating IAsyncEnumerable #3436
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for DCP-related parts, thanks!
@@ -47,7 +47,7 @@ internal async Task SetLogSourceAsync(IAsyncEnumerable<IReadOnlyList<ResourceLog | |||
var cancellationToken = await _cancellationSeries.NextAsync(); | |||
var logParser = new LogParser(); | |||
|
|||
await foreach (var batch in batches.WithCancellation(cancellationToken)) | |||
await foreach (var batch in batches.WithCancellation(cancellationToken).ConfigureAwait(false)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug @ReubenBond, see #3459
@@ -105,7 +105,7 @@ async Task TrackResourceSnapshotsAsync() | |||
|
|||
_resourceSubscriptionTask = Task.Run(async () => | |||
{ | |||
await foreach (var changes in subscription.WithCancellation(_resourceSubscriptionCancellation.Token)) | |||
await foreach (var changes in subscription.WithCancellation(_resourceSubscriptionCancellation.Token).ConfigureAwait(false)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one isn't a problem since Task.Run doesn't capture the sync context.
@@ -39,7 +39,7 @@ public ResourceOutgoingPeerResolver(IDashboardClient resourceService) | |||
await RaisePeerChangesAsync().ConfigureAwait(false); | |||
} | |||
|
|||
await foreach (var changes in subscription.WithCancellation(_watchContainersTokenSource.Token)) | |||
await foreach (var changes in subscription.WithCancellation(_watchContainersTokenSource.Token).ConfigureAwait(false)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are problematic in UI code generally.
This PR qualms the complaints the
EnsureWarningsAreEmittedWhenProjectReferencingLibraries
tests when I run it locally, and it's in-line with our existing practice of using.ConfigureAwait(false)
in Aspire.Microsoft Reviewers: Open in CodeFlow