Repository navigation
Conversation
4fa6a8a to
3599c89
Compare
3599c89 to
90e97cf
Compare
|
/azp run |
|
Commenter does not have sufficient privileges for PR 65785 in repo dotnet/aspnetcore |
| } | ||
|
|
||
| await valueAsStream.CopyToAsync(response.Body); | ||
| await valueAsStream.CopyToAsync(response.Body, context.HttpContext.RequestAborted); |
There was a problem hiding this comment.
Some of the other output formatters catch and swallow OCE if it's caused by RequestAborted
https://source.dot.net/#Microsoft.AspNetCore.Mvc.NewtonsoftJson/NewtonsoftJsonOutputFormatter.cs,161
https://source.dot.net/#Microsoft.AspNetCore.Mvc.Core/Formatters/SystemTextJsonOutputFormatter.cs,101
Although we're not super consistent about doing that.
There was a problem hiding this comment.
I would actually prefer to throw so the exception handler middleware has a chance to log it.
I actually noticed that there is no way to detect an OCE when writing the response. When reading the request however, OCE seem to be thrown and logged properly.
Maybe open a separate issue for this?
There was a problem hiding this comment.
I think we should change all formatters to not catch OCE caused by RequestAborted. And then make a note about breaking change in the docs. Consistency is better IMHO. what's your thoughts here, @BrennanConroy ?
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
Forward CancellationToken in StreamOutputFormatter
Description
This forwards the cancellationToken from the HttpContext in the StreamOutputFormatter so it properly reacts to a client disconnect.
Fixes #65493