-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
Cost:SWork that requires one engineer up to 1 weekWork that requires one engineer up to 1 weekPriority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Threading.Taskscode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixerMarks an issue that suggests a Roslyn code fixer
Milestone
Description
Background and Motivation
The VSTHRD103 analyzer exists and it is broadly valuable. We should promote this analyzer to be part of the standard set of analyzers that ship with the .NET SDK.
Examples of patterns that are flagged by this analyzer
Task DoAsync()
{
file.Read(buffer, 0, 10);
}All methods where an Async-suffixed equivalent exists will produce this warning
when called from a Task-returning method.
In addition, calling Task.Wait(), Task<T>.Result or Task.GetAwaiter().GetResult()
will produce this warning.
Solution
Await the async version of the method:
async Task DoAsync()
{
await file.ReadAsync(buffer, 0, 10);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Cost:SWork that requires one engineer up to 1 weekWork that requires one engineer up to 1 weekPriority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Threading.Taskscode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixerMarks an issue that suggests a Roslyn code fixer