Open poizan42 opened 8 months ago
I suspect this is similar to this notice that plagues my codebase wherever I use my custom WhenAll for ValueTask
s. (It accepts a params ValueTask[]
)
public ValueTask DisposeAsync()
=> ValueTaskExtensions.WhenAll(
RestClient.DisposeAsync(),
GraphQLClient.DisposeAsync());
Analyzer
Diagnostic ID: CA2012:
Use ValueTasks correctly
Analyzer source
SDK: Built-in CA analyzers in .NET 5 SDK or later
Version: SDK 8.0.101
Describe the bug
The following generates CA2012
Steps To Reproduce
Put the following code in any .cs file in Visual Studio
Expected behavior
CA2012 should not be emitted as long as the ValueTask is only consumed once and not otherwise escapes.
Actual behavior
CA2012 is emitted at the "." of
foo?.FrobAsync()