Analyzer: Detect using Task<T> with RequestDelegate #42523
Labels
analyzer
Indicates an issue which is related to analyzer experience
old-area-web-frameworks-do-not-use
*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
RequestDelegate
can be used with methods/lambdas that return a value which is then ignored.Delegate signature:
aspnetcore/src/Http/Http.Abstractions/src/RequestDelegate.cs
Lines 6 to 11 in 86c7e01
Because
Task
is the base type ofTask<T>
, generic variance means it's possible to do this:Example: #39956
Describe the solution you'd like
Write an analyzer that detects using a method or lambda that returns
Task<T>
withRequestDelegate
and warns the user.Additional context
No response
The text was updated successfully, but these errors were encountered: