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

'dotnet_style_require_accessibility_modifiers = always' doesn't work for interface members #74244

Open
TessenR opened this issue Jul 2, 2024 · 0 comments
Assignees
Labels

Comments

@TessenR
Copy link

TessenR commented Jul 2, 2024

Version Used:

Microsoft Visual Studio Professional 2022
Version 17.10.0 Preview 6.0
VisualStudio.17.Preview/17.10.0-pre.6.0+34825.169
Microsoft .NET Framework
Version 4.8.09037

Steps to Reproduce:

Set the option in editorconfig:

dotnet_style_require_accessibility_modifiers = always:error

Compile the following code:

public interface IInterface
{
  void Method();
}

Diagnostic Id:

IDE0040 Add accessibility modifiers

Expected Behavior:
There should be an error indicating that a public modifier for void Method() is required

Actual Behavior:
There's no IDE0040 inspection. dotnet_style_require_accessibility_modifiers = always is behaving the same as dotnet_style_require_accessibility_modifiers = for_non_interface_members

Notes:
This code looks outdated, there's already a version of C# that supports modifiers on interface members:

#if false
// Add this once we have the language version for C# that supports accessibility
// modifiers on interface methods.
if (option.Value == AccessibilityModifiersRequired.Always &&
member.IsKind(SyntaxKind.InterfaceDeclaration, out typeDeclaration))
{
// Only recurse into an interface if the user wants accessibility modifiers on
ProcessTypeDeclaration(context, generator, option, typeDeclaration);
}
#endif

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

No branches or pull requests

3 participants