Skip to main content
Source: Al0106AvoidTaskRunInAspNetCoreAnalyzer.cs

Description

ASP.NET Core request handlers already execute on the thread pool. Using Task.Run() adds unnecessary overhead by scheduling work to another thread pool thread.

Bad Code

Good Code

Properties

  • Category: ASP.NET Core
  • Severity: Warning
  • Enabled by default: True
  • Code fix available: False

Configuration