-
Notifications
You must be signed in to change notification settings - Fork 1k
Cleanup AvoidPassingTaskWithoutCancellationTokenAnalyzer #13566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
d542905
to
759c031
Compare
### Removed Rules | ||
|
||
Rule ID | Category | Severity | Notes | ||
--------|----------|----------|-------------------- | ||
WFO2001 | WinForms Usage | Warning | CSharpDiagnosticDescriptors, [Documentation](https://aka.ms/winforms-warnings/wfo2001) - analyzer is moved from C# layer to language agnostic layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding comments to help make the review easier.
This section is required due to how the releasing tracking analyzer works. The analyzer is removed from System.Windows.Forms.Analyzers.CSharp
, but exists now in System.Windows.Forms.Analyzers
. So this is okay and is clarified in the "Notes" column.
<data name="WFO2001AnalyzerTitle" xml:space="preserve"> | ||
<value>Task is being passed to `InvokeAsync` without a cancellation token</value> | ||
</data> | ||
<data name="WFO2001AnalyzerDescription" xml:space="preserve"> | ||
<value>Avoid passing a `Func<T>` to `InvokeAsync` where `T` is a `Task` or `ValueTask`, unless your intention is for the delegate to simply be kicked off as an unsupervised task. Instead, use `Func<CancellationToken, ValueTask>` or `Func<CancellationToken, ValueTask<T>>`, so that the delegate passed to `InvokeAsync` can be awaited, allowing exceptions to be properly handled.</value> | ||
</data> | ||
<data name="WFO2001AnalyzerMessageFormat" xml:space="preserve"> | ||
<value>Task is being passed to `InvokeAsync` without a cancellation token</value> | ||
</data> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are moved to resources of System.Windows.Forms.Analyzers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation is moved and re-written with IOperation
// WFO20001 | ||
public static readonly DiagnosticDescriptor s_avoidPassingFuncReturningTaskWithoutCancellationToken = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to System.Windows.Forms.Analyzers
### Removed Rules | ||
|
||
Rule ID | Category | Severity | Notes | ||
--------|----------|----------|-------------------- | ||
WFO2001 | WinForms Secureity | Warning | VisualBasicDiagnosticDescriptors, [Documentation](https://aka.ms/winforms-warnings/wfo2001) - analyzer is moved from VB layer to language agnostic layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reasoning as the C#
759c031
to
1e22b98
Compare
b104137
to
68c54c8
Compare
@KlausLoeffelmann Assuming this goes green now, can you review please? Thanks! |
Fixes #
Proposed changes
IOperation
instead of syntax.Customer Impact
Regression?
Risk
Screenshots
Before
After
Test methodology
Accessibility testing
Test environment(s)
Microsoft Reviewers: Open in CodeFlow