IDE1006 "Naming rule violation" is not triggered in all async cases
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
**Version Used**: VS 17.9.6
**Steps to Reproduce**:
EditorConfig:
```
dotnet_naming_symbols.async_methods.applicable_kinds = method,local_function
dotnet_naming_symbols.async_methods.required_modifiers = async
dotnet_naming_style.pascal_case_async_suffix.capitalization = pascal_case
dotnet_naming_style.pascal_case_async_suffix.required_suffix = Async
dotnet_naming_rule.async_methods_pascal_case_async_suffix.symbols = async_methods
dotnet_naming_rule.async_methods_pascal_case_async_suffix.style = pascal_case_async_suffix
dotnet_naming_rule.async_methods_pascal_case_async_suffix.severity = warning
```
Sample code:
```cs
public async Task Test1()
{
await Task.Delay(1);
}
public Task Test2()
{
return Task.Delay(1);
}
public IAsyncEnumerable Test3()
{
return null;
}
```
**Diagnostic Id**:
IDE1006 Naming rule violation: Missing suffix: 'Async'
**Expected Behavior**:
All 3 methods show the diagnostic.
**Actual Behavior**:
Only `Test1` shows the diagnostic.
I know that you explicitly have to configure a "async modifier" in the naming rule. But there is no other way to configure a rule for methods with awaitable return types.
Note: I wasn't sure about `Test3`, but [VSTHRD200](https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD200.md) does show it as requiring an "Async" suffix (related issue: https://github.com/microsoft/vs-threading/issues/431). Also there is this comment from @stephentoub: https://github.com/dotnet/runtime/issues/27547#issuecomment-478384285
Contributor guide
Research direction
Reproduce the IDE1006 behavior using the supplied EditorConfig and Test1, Test2, and Test3 samples in VS 17.9.6. Read the referenced VSTHRD200 guidance and related issue to compare how awaitable return types are treated. Done means all three methods show the Missing suffix: 'Async' diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100