Skip to content

Add resolution guidance to CS1023 compiler error documentation #47631

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 2 commits into from
Aug 4, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 29, 2025

The CS1023 compiler error documentation was missing resolution guidance, leaving developers without clear instructions on how to fix the error. This enhancement adds:

What was added:

  • Clear resolution section explaining that braces are needed to create block statements
  • Complete corrected code examples showing the proper solution
  • Brief explanation of why C# requires this (scope rules) and how it differs from C/C++

Before: The documentation only showed what causes the error but not how to fix it.

After: Developers now have practical examples showing both the problematic code and the corrected version:

// Problem - generates CS1023
if (condition)
    int i;  // CS1023: declaration not valid here

// Solution - wrap in braces
if (condition)
{
    int i;  // Fixed: now in a block statement
}

The changes follow the established pattern used in other CS error documentation (like CS0017 and CS0131) that include "To resolve this error" sections with practical solutions.

Fixes #28064.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

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

@Copilot Copilot AI changed the title [WIP] Confusion over embedded statement difference between C/C++ and C# Add resolution guidance to CS1023 compiler error documentation Jul 29, 2025
@Copilot Copilot AI requested a review from BillWagner July 29, 2025 21:13
Copilot finished work on behalf of BillWagner July 29, 2025 21:13
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 also LGTM. It's ready for final review

@BillWagner BillWagner marked this pull request as ready for review July 30, 2025 18:01
@BillWagner BillWagner requested a review from a team as a code owner July 30, 2025 18:01
@BillWagner BillWagner requested a review from tdykstra July 30, 2025 18:01
@BillWagner BillWagner enabled auto-merge (squash) July 30, 2025 18:01
@BillWagner BillWagner merged commit 4dd6663 into main Aug 4, 2025
14 checks passed
@BillWagner BillWagner deleted the copilot/fix-28064 branch August 4, 2025 23:13
@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Aug 4, 2025
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.

Confusion over embedded statement difference between C/C++ and C#
2 participants