You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a minimal .NET 6 console app repro - using ConfigureAwaitChecker.Analyzer v5.0.0.1, in VS2022 Professional v17.2.5
Console.WriteLine("Hello, World!");
var y = await DoSomethingElseAsync().ConfigureAwait(false);
async Task<int> DoSomethingElseAsync()
{
var foo = new Foo();
await using var s = await foo.GetStreamAsync().ConfigureAwait(false);
return 0;
}
public class Foo
{
public async Task<Stream> GetStreamAsync()
{
return await this.AllocateStreamAsync().ConfigureAwait(false);
}
private async Task<Stream> AllocateStreamAsync()
{
return await Task.FromResult(new MemoryStream()).ConfigureAwait(false);
}
}
I'm getting an "intermittent" CAC001 error on the await using call at line 8. And by "intermittent" I mean sometimes it's there, sometimes it's not - see the following screen captures:
After doing nothing but deleting the blank line after Console.WriteLine() I get this
And then sometimes it disappears completely and comes back seemingly at random based on unrelated code changes.
The text was updated successfully, but these errors were encountered:
Not sure why it's intermittent, but I'll check how's the analyzer called and how the tree looks like.
The "fixed" code should be something like await using var s = (await foo.GetStreamAsync().ConfigureAwait(false)).ConfigureAwait(false); (or maybe rather var x = await foo.GetStreamAsync().ConfigureAwait(false); await using var s = x.ConfigureAwait(false);, but that's related to #28).
Note to self: Add tests for await using var x = (await foo.FooAsync().ConfigureAwait(false)).ConfigureAwait(false);.
Here's a minimal .NET 6 console app repro - using
ConfigureAwaitChecker.Analyzer
v5.0.0.1, in VS2022 Professional v17.2.5I'm getting an "intermittent" CAC001 error on the
await using
call at line 8. And by "intermittent" I mean sometimes it's there, sometimes it's not - see the following screen captures:After doing nothing but deleting the blank line after
Console.WriteLine()
I get thisAnd then sometimes it disappears completely and comes back seemingly at random based on unrelated code changes.
The text was updated successfully, but these errors were encountered: