Skip to content

Add build-only diagnostic note to CS0169 documentation #47309

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 14, 2025

Adds a note to the CS0169 compiler warning documentation explaining that it's a "build-only" diagnostic that behaves differently from most compiler warnings.

Changes Made

  • Added a NOTE section to docs/csharp/misc/cs0169.md explaining that CS0169 is only reported during explicit Build or Rebuild operations
  • Clarifies that the warning doesn't appear during typing in the IDE as part of IntelliSense diagnostics
  • Explains that warnings may persist in the error list after code fixes until a rebuild is performed

Why This Matters

This behavior differs from the majority of compiler warnings/errors, which automatically refresh while typing. The inconsistency leads to user confusion when warnings persist after the underlying issue is resolved, as reported in multiple feedback tickets.

The note uses the same format as other documentation files (following the pattern in CS0219.md) and passed markdown linting validation.

Fixes #26708.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.


Internal previews

Toggle expand/collapse
📄 File 🔗 Preview link
docs/csharp/language-reference/compiler-messages/cs0518.md docs/csharp/language-reference/compiler-messages/cs0518
docs/csharp/language-reference/compiler-messages/cs0570.md docs/csharp/language-reference/compiler-messages/cs0570
docs/csharp/language-reference/compiler-messages/cs1607.md docs/csharp/language-reference/compiler-messages/cs1607
docs/csharp/language-reference/compiler-messages/cs8178.md docs/csharp/language-reference/compiler-messages/cs8178
docs/csharp/misc/cs0017.md docs/csharp/misc/cs0017
docs/csharp/misc/cs0028.md docs/csharp/misc/cs0028
docs/csharp/misc/cs0067.md docs/csharp/misc/cs0067
docs/csharp/misc/cs0148.md docs/csharp/misc/cs0148
docs/csharp/misc/cs0169.md docs/csharp/misc/cs0169
docs/csharp/misc/cs0204.md docs/csharp/misc/cs0204
docs/csharp/misc/cs0402.md docs/csharp/misc/cs0402
docs/csharp/misc/cs0414.md docs/csharp/misc/cs0414
docs/csharp/misc/cs0649.md docs/csharp/misc/cs0649
docs/csharp/misc/cs0656.md docs/csharp/misc/cs0656
docs/csharp/misc/cs1555.md docs/csharp/misc/cs1555
docs/csharp/misc/cs1556.md docs/csharp/misc/cs1556
docs/csharp/misc/cs1558.md docs/csharp/misc/cs1558
docs/csharp/misc/cs5001.md docs/csharp/misc/cs5001

@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Jul 14, 2025
@Copilot Copilot AI changed the title [WIP] We should add a note that CS0169 is a "Build-only" diagnostic Add build-only diagnostic note to CS0169 documentation Jul 14, 2025
@Copilot Copilot AI requested a review from BillWagner July 14, 2025 19:18
Copilot finished work on behalf of BillWagner July 14, 2025 19:18
@BillWagner
Copy link
Member

This looks great @copilot

Can you make the same change in all the error message files referenced in this comment: #26708 (comment)

Because there are a large number of them, you should move the note to an include file.

Copy link
Contributor Author

Copilot AI commented Jul 15, 2025

This looks great @copilot

Can you make the same change in all the error message files referenced in this comment: #26708 (comment)
...

I've updated all the build-only diagnostic error documentation files as requested. Created a shared include file at ~/includes/csharp-build-only-diagnostic-note.md and updated all 9 relevant CS error files (CS0017, CS0028, CS0067, CS0169, CS0279, CS0402, CS0414, CS0649, CS5001) to use this include. This ensures consistency and makes future maintenance easier. All changes have been validated with markdown linting. Commit: d1b856c

Copilot finished work on behalf of BillWagner July 15, 2025 14:58
@BillWagner
Copy link
Member

@copilot Your latest change updates 9 articles. The highlighted range https://github.com/dotnet/roslyn/blob/e263437db49b0650dbc72fca3331df654e05987c/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs#L531-L573 shows 33 different articles. Why the discrepancy?

Copy link
Contributor Author

Copilot AI commented Jul 15, 2025

@copilot Your latest change updates 9 articles. The highlighted range https://github.com/dotnet/roslyn/blob/e263437db49b0650dbc72fca3331df654e05987c/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs#...

You're right - I had only updated 9 error documentation files but the Roslyn ErrorFacts.cs file shows 33+ build-only diagnostics. I've now analyzed the complete list and updated all 18 CS error files that have documentation and are marked as build-only diagnostics in the Roslyn source. I also removed the note from CS0279 which was incorrectly included as it's not actually a build-only diagnostic. The discrepancy was due to: 1) Some build-only diagnostics don't have documentation files yet, and 2) I had missed 10 files in my initial implementation. All documented build-only diagnostics now include the shared note. Commit: 03c4b1e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csharp-diagnostics/subsvc csharp-errors-warnings/subsvc dotnet-csharp/svc lang-reference/subsvc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We should add a note that CS0169 is a "Build-only" diagnostic
2 participants