dotnet/roslyn

Asynchronous methods and variables not showing unused warning

开放

#52,328 创建于 2021年4月1日

 (7 条评论) (1 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-IDEhelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

Version Used: Version 16.9.0 Preview 3.0

Steps to Reproduce:

  1. Set a variable to an asynchronous await call var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false))

  2. Do not use the variable

  3. Create an asynchronous method

  4. Do not call the asynchronous method

Expected Behavior: Green underline appears underneath root and method header name indicating that the variable/method is unused.

Actual Behavior: The unused warning does not appear.

Note: I may be missing an option selection that would make it so the warning appears in this case, but I am unsure.

贡献者指南