Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 894 Bytes

File metadata and controls

20 lines (14 loc) · 894 Bytes

AL1109: Avoid Task.Run in ASP.NET Core request handlers

Property Value
Severity Warning
Category ASP.NET Core
Code fix No
Analyzer Al1109AvoidTaskRunInAspNetCoreAnalyzer
Enabled by default Yes

Description

ASP.NET Core request handling already runs on thread pool threads. Using Task.Run to offload work to another thread pool thread adds scheduling overhead and context switching without benefit. For CPU-bound work that genuinely needs to not block the request, consider using a background service or suppress this diagnostic with a justification.

See also