-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Add CancellationToken overloads for reading multipart form sections #41532
Comments
Ah, this is useful now because StreamReader.ReadToEndAsync now accepts a CT. |
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
Thanks for contacting us. We're moving this issue to the |
Opportunity for optimization! |
API Review Notes:
Approved: namespace Microsoft.AspNetCore.WebUtilities;
public class FormMultipartSection
{
+ public ValueTask<string> GetValueAsync(CancellationToken cancellationToken);
}
public static class MultipartSectionStreamExtensions
{
+ public static async ValueTask<string> ReadAsStringAsync(this MultipartSection section, CancellationToken cancellationToken);
} |
Add CancellationToken overloads to methods for reading multipart form sections and use in FormFeature. Update MultipartSectionStreamExtensions to apply IDE refactoring suggestions. Relates to dotnet#41532.
Background and Motivation
While checking for other usages of
ReadAsStringAsync()
when working on #41531, I found one other occurrence here:aspnetcore/src/Http/WebUtilities/src/FormMultipartSection.cs
Lines 56 to 59 in c85baf8
As well as adding an overload for a
CancellationToken
parameter there, another would be needed here:aspnetcore/src/Http/WebUtilities/src/MultipartSectionStreamExtensions.cs
Lines 14 to 19 in c85baf8
The new overload could then be used here:
aspnetcore/src/Http/Http/src/Features/FormFeature.cs
Line 248 in c85baf8
Proposed API
Usage Examples
Alternative Designs
Add an optional parameter instead as a binary-breaking change for .NET 7.
Risks
None known.
The text was updated successfully, but these errors were encountered: