dotnet/roslyn

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

开放

#75,675 创建于 2024年10月30日

 (4 条评论) (3 个反应) (0 位负责人)C# (4,257 个派生)batch import
help wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南