dotnet/aspnetcore

HttpContext RequestAborted no longer works.

Open

#38.917 aberto em 9 de dez. de 2021

Ver no GitHub
 (22 comments) (8 reactions) (0 assignees)C# (10.653 forks)batch import
area-ui-renderingbugfeature-spagood first issuehelp wanted

Métricas do repositório

Stars
 (37.933 stars)
Métricas de merge de PR
 (Mesclagem média 16d 9h) (258 fundiu PRs em 30d)

Description

Describe the bug

Since .NET 6, the HttpContext.RequestAborted does not updates when the request is cancelled. This used to work with .NET 5. IsCancellationRequested stays in false even tho the request has been canceled and CanBeCancelled is set to true.

To Reproduce

I started a .NET 6 Angular project and created an HTTP GET request and subscribe to it, the Request is in an infinite loop intentionally so it can only be ended by the cancellation token. Also have a subject to cancel the request with an other button.

In .NET 5 this works flawlessly. In .NET 6 its unusable.

An Example Repo can be found here: https://github.com/blogcraft/TestCancel

Exceptions (if any)

Further technical details

  • ASP.NET Core version: .NET 6.0.100
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version: VS Code
  • Include the output of dotnet --info:

Entorno de tiempo de ejecución: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.100\

Host (useful for support): Version: 6.0.0 Commit: 4822e3c3aa

.NET SDKs installed: 3.1.415 [C:\Program Files\dotnet\sdk] 5.0.401 [C:\Program Files\dotnet\sdk] 6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download

Guia do colaborador