Skip to content

Commit 2d9a142

Browse files
committed
C# test: Make sure, awaitf is not suggested on a custom awaitable, even if ConfigureAwait is present.
1 parent ab7dc34 commit 2d9a142

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/EditorFeatures/CSharpTest/Completion/CompletionProviders/AwaitCompletionProviderTests.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,36 @@ static async Task Main()
386386
}", LanguageVersion.CSharp9, dotAwait: true);
387387
}
388388

389+
[Fact]
390+
public async Task TestDotAwaitSuggestAfterDotOnCustomAwaitableButNotConfigureAwaitEvenIfPresent()
391+
{
392+
await VerifyKeywordAsync(@"
393+
using System;
394+
using System.Runtime.CompilerServices;
395+
using System.Threading.Tasks;
396+
397+
public class DummyAwaiter: INotifyCompletion {
398+
public bool IsCompleted => true;
399+
public void OnCompleted(Action continuation) => continuation();
400+
public void GetResult() {}
401+
}
402+
403+
public class CustomAwaitable
404+
{
405+
public DummyAwaiter GetAwaiter() => new DummyAwaiter();
406+
public ConfiguredTaskAwaitable ConfigureAwait(bool continueOnCapturedContext) => default;
407+
}
408+
409+
static class Program
410+
{
411+
static async Task Main()
412+
{
413+
var awaitable = new CustomAwaitable();
414+
awaitable.$$;
415+
}
416+
}", LanguageVersion.CSharp9, dotAwait: true, dotAwaitf: false);
417+
}
418+
389419
[Fact]
390420
public async Task TestDotAwaitSuggestAfterDotDot()
391421
{

0 commit comments

Comments
 (0)