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

New rule proposal: Propagate cancellation tokens #37

Open
sharwell opened this issue Sep 10, 2015 · 7 comments
Open

New rule proposal: Propagate cancellation tokens #37

sharwell opened this issue Sep 10, 2015 · 7 comments

Comments

@sharwell
Copy link
Member

This diagnostic would be reported when CancellationToken.None is explicitly provided in a call, but another cancellation token is available in the current context (see #36 and #32 for comments describing the current context).

The code fix for this would replace the use of CancellationToken.None with the "best" cancellation token as described in the code fix for #36.

@vweijsters
Copy link

👍

@tmaczynski
Copy link
Contributor

I will implement this analysis.

@tmaczynski
Copy link
Contributor

I think that this analysis should be also triggered if default(CancellationToken) is provided in a method call as it's equal to CancellationToken.None.

@sharwell
Copy link
Member Author

@tmaczynski Yes, that's correct.

@tmaczynski
Copy link
Contributor

I'm hesitating if local fields of type CancellationToken should be considered in this diagnostic or not (current description suggests that they should not), any thought on that?

Also, I think that all CancellationToken parameters, local variables (and possibly, fields) should be suggested by a codefix provider, not only the "best" (innermost) one.

@sharwell
Copy link
Member Author

sharwell commented Jul 17, 2017

@tmaczynski I'm not sure for fields. I could see it going either way.

@sharwell
Copy link
Member Author

@tmaczynski Oh, maybe just treat this as a potential context object?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants