Problems with async_methods_must_end_with_async on Main and names starting with capital I and another capital letter
Hello Community!
I am having some troubled with the async_methods_must_end_with_async rule in two different occasions.
Related settings:
.editorconfig
```
dotnet_naming_symbols.method_symbols.applicable_kinds = method
dotnet_naming_symbols.method_symbols.required_modifiers = async
dotnet_naming_rule.async_methods_must_end_with_async.severity = error
dotnet_naming_rule.async_methods_must_end_with_async.symbols = method_symbols
dotnet_naming_rule.async_methods_must_end_with_async.style = end_in_async_style
dotnet_naming_style.end_in_async_style.capitalization = pascal_case
dotnet_naming_style.end_in_async_style.required_suffix = Async
```
All code style inspections for C# in the naming tab have been disabled (it's a long list containing '(not inspected)' for each element).
In the first case I am getting an error on the Main method
Name 'Main' does not match rule 'async_methods_must_end_with_async'. Suggested name is 'MainAsync'
Now this name is not valid, c# is not able to find an entry point if I change it.
In the second case I have a company, I'll change the name, but the important part is that the name is in the format `IBanana`, it starts with a capital I, and then another capital letter. The error is as follows:
Name 'IBananaFactoryAsync' does not match rule 'async_methods_must_end_with_async'. Suggested name is 'BananaFactoryAsync'.
Normally I would solve this with a simple ReSharper disable once, however, my company does not want any ReSharper-specific lines in the code base, and thus if I add a ReSharper disable once, the pull request will not be accepted.
Does anyone know of a way to get rid of these errors, other than disabling the rules all together?
Please note, both of these cases are not marked at all in Visual Studio 2022.
Please sign in to leave a comment.
Hello Rafael,
Unfortunately, you can disable the InconsistentNaming inspection for a single method only by editing your file. Besides adding //Resharper disable once comment, or a SuppressMessage attribute, e.g. [SuppressMessage("ReSharper", "InconsistentNaming")], you could try adding #pragma warning disable InconsistentNaming, this does not mention ReSharper, so maybe it would work for you.
There is an open issue on our tracker that describes the same behavior: RIDER-80823. We would appreciate it if you would upvote it in order to bring increased awareness to the issue. One can also click Watch for monitoring the status.
Thank you for reporting this. I have submitted a new issue RSRP-491776, please upvote and subscribe for future updates by clicking Watch. Don't let the ReSharper project bother you, this code is common for Rider and R#, so once a fix is introduced then it will make it to both products.
Thanks for looking into this and creating/upvoting issues! I have upvoted both and watched both. Fingers crossed that it gets resolved.