Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Latest commit

 

History

History
43 lines (33 loc) · 1.02 KB

File metadata and controls

43 lines (33 loc) · 1.02 KB

IncludeCancellationParameter

TypeName IncludeCancellationParameterAnalyzer
CheckId IncludeCancellationParameter
Category Usage Rules

Cause

An asynchronous method does not include a CancellationToken parameter.

Rule description

This diagnostic identifies asynchronous methods which do not include a CancellationToken parameter in their signature.

How to fix violations

To fix a violation of this rule, add a CancellationToken parameter to the signature of the method.

How to suppress violations

[SuppressMessage("AsyncUsage.CSharp.Usage", "IncludeCancellationParameter", Justification = "Reviewed.")]
#pragma warning disable IncludeCancellationParameter // Include CancellationToken parameter
public Task<int> ThisMethodCannotBeCancelled()
#pragma warning restore IncludeCancellationParameter // Include CancellationToken parameter
{
    return Task.FromResult(0);
}