Back to Aspnetcore

ASP0021: The return type of the BindAsync method must be ValueTask

aspnetcore/diagnostics/asp0021.md

latest985 B
Original Source

ASP0021: The return type of the BindAsync method must be ValueTask<T>.

Value
Rule IDASP0021
CategoryUsage
Fix is breaking or non-breakingNon-breaking

Cause

An implementation of the xref:Microsoft.AspNetCore.Http.IBindableFromHttpContext%601.BindAsync%2A method has a return type that isn't xref:System.Threading.Tasks.ValueTask%601.

Rule description

This diagnostic is emitted when an implementation of the BindAsync method has a return type that isn't ValueTask<T>.

How to fix violations

To fix a violation of this rule, define a ValueTask<T> return type for BindAsync and consider implementing xref:Microsoft.AspNetCore.Http.IBindableFromHttpContext%601 to enforce implementation.

When to suppress warnings

Do not suppress a warning from this rule.