Open YuliiaKovalova opened 5 months ago
A dupe from https://github.com/dotnet/roslyn/issues/73021
Consider, also:
var asyncDisposable = new AsyncDisposable();
await using (asyncDisposable.ConfigureAwait(false))
{
Foo();
}
I would not expect this to result in a warning as long as asyncDisposable
is not accessed again outside of the await using
block.
Note: In the event of ConfigureAwait()
being applied, the disposable becomes type ConfiguredAsyncDisposable
Analyzer
Diagnostic ID: CA2000
Steps to Reproduce: These code parts in MSBuild generates CA2000: https://github.com/dotnet/msbuild/blob/6fec6072f0591bede57a71474ddc08b95e3e4c28/src/Build/Evaluation/IntrinsicFunctions.cs#L294 https://github.com/dotnet/msbuild/blob/0c367243662fe7923f70d4a1b55b12be8afa07b2/src/Tasks/Unzip.cs#L117
Expected Behavior: No warning occurs.
Actual Behavior: The warning is displayed.