Skip to content

Update CS1617 documentation to clarify how to list supported C# language versions #47377

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

Merged
merged 3 commits into from
Jul 17, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 15, 2025

The CS1617 compiler error documentation previously mentioned using <LangVersion>?</LangVersion> to list supported values but didn't explain how to actually see this list, leading to user confusion.

Changes Made

Updated docs/csharp/misc/cs1617.md to provide clear, practical guidance on how to list supported C# language versions:

1. Reference table approach (recommended)

Points users to the existing comprehensive table of language versions as the most reliable method.

2. Direct compiler approach

Shows how to use the C# compiler directly:

dotnet exec "/path/to/dotnet/sdk/version/Roslyn/bincore/csc.dll" -langversion:?

3. Project file approach with proper warnings

Explains the diagnostic output method while clearly warning about build failures:

dotnet build -v diagnostic

Key Improvements

  • Addresses user confusion: Explains that <LangVersion>?</LangVersion> works but causes build failures
  • Provides practical alternatives: Multiple methods to see supported language versions
  • Clear warnings: Explains why the project file approach isn't recommended for normal development
  • OS-agnostic guidance: Notes that compiler paths vary by operating system and SDK version

The updated documentation resolves the issue by explaining that while <LangVersion>?</LangVersion> technically works, it causes the compiler to exit after listing versions instead of continuing compilation, which leads to build failures.

Fixes #27101.


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


Internal previews

📄 File 🔗 Preview link
docs/csharp/misc/cs1617.md docs/csharp/misc/cs1617

@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Jul 15, 2025
@Copilot Copilot AI changed the title [WIP] How to list supported values of C# language versions Update CS1617 documentation to clarify how to list supported C# language versions Jul 15, 2025
@Copilot Copilot AI requested a review from BillWagner July 15, 2025 15:21
Copilot finished work on behalf of BillWagner July 15, 2025 15:21
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM and is ready for final review.

@BillWagner BillWagner marked this pull request as ready for review July 16, 2025 15:12
@BillWagner BillWagner requested a review from a team as a code owner July 16, 2025 15:12
@BillWagner BillWagner requested a review from IEvangelist July 16, 2025 15:12
@Copilot Copilot AI requested a review from gewarren July 17, 2025 00:55
Copilot finished work on behalf of gewarren July 17, 2025 00:55
@BillWagner BillWagner merged commit f684076 into main Jul 17, 2025
10 checks passed
@BillWagner BillWagner deleted the copilot/fix-27101 branch July 17, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csharp-errors-warnings/subsvc dotnet-csharp/svc 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.

How to list supported values of C# language versions
3 participants