dotnet/roslyn

```await``` completion should trigger on ```yield``` in IAsyncEnumerables

Open

#75.675 aberto em 30 de out. de 2024

Ver no GitHub
 (4 comments) (3 reactions) (0 assignees)C# (4.257 forks)batch import
help wanted

Métricas do repositório

Stars
 (20.414 stars)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

Description

Version Used: 17.11.5 Steps to Reproduce:

  1. Start with this code:
namespace ConsoleApp44 {
    internal class Program {
        
        public static Task Test1() {

        }

        public static IAsyncEnumerable<int> Test2() {
        
        }

    }
}
  1. Place your cursor inside Test1 and type await. The method changes to async. This is good. Image

  2. Now, place your cursor inside of test2 and type yield. The method does NOT change to async. This is bad. Image

Expected Behavior: An IAsyncEnumerable can only yield if it is async. Therefore, the same completion should trigger as when you do an await.

Actual Behavior: Nothing happens. I have to manually update the method signature.

Guia do colaborador