-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Use await using in HttpContentJsonExtensions #113359
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
Conversation
src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpContentJsonExtensions.cs
Outdated
Show resolved
Hide resolved
FYI @dotnet/area-system-text-json |
It does... but does this actually meaningfully help anything? Typically Stream's IAsyncDisposable helps with performing asynchronous flushes of written data, but the usage here is all reading. I don't believe any of streams used by HttpClient will do anything better from DisposeAsync than they would from Dispose. I'm not convinced this is worth the churn. |
{ | ||
using (Stream contentStream = await GetContentStreamAsync(content, cancellationToken).ConfigureAwait(false)) | ||
Stream contentStream = await GetContentStreamAsync(content, cancellationToken).ConfigureAwait(false); | ||
await using (contentStream.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 has compilation errors.
This pull request has been automatically marked |
This pull request will now be closed since it had been marked |
Stream always implements IAsyncDisposable.