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

New rule proposal: Provide CancellationToken in calls #36

@sharwell

Description

@sharwell

This diagnostic would be reported if a method M is called without providing a CancellationToken, and either M or one of its overloads has a CancellationToken parameter.

The code fix for this would attempt to fill in the CancellationToken as follows:

  1. If a local variable or parameter provides a CancellationToken (with consideration for context objects as described in New rule proposal: Async methods should have a CancellationToken parameter #32), the innermost visible CancellationToken is passed.
  2. Otherwise, pass CancellationToken.None.

⚠️ Separate equivalence keys should be used for the code fix for the case where the updated call still calls the same method, and the case where the updated call is to a different overload of the method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions