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

CS1591 Thinks "protected" is public #68863

Open
RadicalErin opened this issue Jul 3, 2023 · 2 comments
Open

CS1591 Thinks "protected" is public #68863

RadicalErin opened this issue Jul 3, 2023 · 2 comments
Labels
Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. Question Resolution-By Design The behavior reported in the issue matches the current design
Milestone

Comments

@RadicalErin
Copy link

RadicalErin commented Jul 3, 2023

The error message around CS1591 ["missing xml comment for publicly visible type or member"] describes the item the warning relates to as "publicly visible". It also activates on protected members. I'm not sure if it is entirely desired or not, for the warning to throw on protected members. If not, then it is occurring unintentionally. If so, then the message is a bit inaccurate. It might also be nice to be able to configure whether CS1591 triggers for private/protected items, or not.

Version Used:
.Net 6.0
Compiler version: 4.6.0-3.23259.8 (c3cc1d0c)
Language version: 10.0

Steps to Reproduce:

  1. Ensure that the documentation file option is set.
  2. Create a class containing a protected member, and do not provide XML comment blocks for protected member(s).
  3. If relevant, do not disable CS1591 around these members

Diagnostic Id:
CS1591

Expected Behavior:
Either no warning about comments [CS1591], because protected is not publicly visible, or if it is desired because of inheritance, a clearer message.

Actual Behavior:
Warning that describes the item as "publicly visible"

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 3, 2023
@Youssef1313
Copy link
Member

The warning looks correct to me. The protected members are publicly visible. The word "publicly" here doesn't really mean the public modifier, but it means it's visible to the outer world (outside of the assembly containing it)

@jcouv jcouv added Question Resolution-By Design The behavior reported in the issue matches the current design and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 5, 2023
@jcouv jcouv added this to the 17.8 milestone Jul 5, 2023
@RadicalErin
Copy link
Author

I can see the thinking behind that. I think maybe the word "publicly" might be better phrased as "externally", so that it's not tied to a magic word that means something very specific. I'd be curious to see what people think about that.

@RikkiGibson RikkiGibson added the Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. label Aug 3, 2023
@RikkiGibson RikkiGibson modified the milestones: 17.8, Backlog Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. Question Resolution-By Design The behavior reported in the issue matches the current design
Projects
None yet
Development

No branches or pull requests

4 participants