Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE1006 "Naming rule violation" is not triggered in all async cases #73505

Open
cremor opened this issue May 16, 2024 · 0 comments
Open

IDE1006 "Naming rule violation" is not triggered in all async cases #73505

cremor opened this issue May 16, 2024 · 0 comments
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@cremor
Copy link

cremor commented May 16, 2024

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:

public async Task Test1()
{
    await Task.Delay(1);
}

public Task Test2()
{
    return Task.Delay(1);
}

public IAsyncEnumerable<object> 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 does show it as requiring an "Async" suffix (related issue: microsoft/vs-threading#431). Also there is this comment from @stephentoub: dotnet/runtime#27547 (comment)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

1 participant