dotnet / dotnet/aspnetcore

StreamOutputFormatter doesn't react to client disconnect

Open
#65,493 0 comments 0 reactions 0 assignees View on GitHub
area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

We have a controller action returning a stream and had a HTTP request hanging here after the client had already disconnected:

https://github.com/dotnet/aspnetcore/blob/e742462cfbe457e627ad95a9d47e90d8372e43cb/src/Mvc/Mvc.Core/src/Formatters/StreamOutputFormatter.cs#L40

I assume this is missing `context.HttpContext.RequestAborted` as a `cancellationToken`.

I could make a PR (or feel free to assign it to Copilot).

### Expected Behavior

Request should abort when client disconnects.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

.NET 10.0.3

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.