Content-Length: 508169 | pFad | http://github.com/dotnet/docs/pull/46258

8E Add documentation for compiler error CS9036 by Copilot · Pull Request #46258 · dotnet/docs · GitHub
Skip to content

Add documentation for compiler error CS9036 #46258

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 14 commits into from
May 29, 2025
Merged

Add documentation for compiler error CS9036 #46258

merged 14 commits into from
May 29, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 19, 2025

This PR adds documentation for the compiler error CS9036, which occurs when attempting to use a nested member or collection initializer syntax with a required member.

The error happens in scenarios like this:

class C
{
    public string? Prop { get; set; }
}

class Program
{
    public required C C { get; set; }
    
    static void Main()
    {
        var program = new Program()
        {
            // error CS9036: Required member 'Program.C' must be assigned a value, it cannot use a nested member or collection initializer.
            C = { Prop = "a" }
        };
    }
}

The documentation includes:

  • Clear description of when this error occurs
  • Code sample demonstrating the error
  • Solution showing the correct way to initialize required members
  • References to related documentation on required members and object initializers

Fixes #46104.


💡 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/language-reference/compiler-messages/cs9036.md docs/csharp/language-reference/compiler-messages/cs9036
docs/csharp/language-reference/toc.yml docs/csharp/language-reference/toc
docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Rosyln error CS9036 not described Add documentation for compiler error CS9036 May 19, 2025
@Copilot Copilot AI requested a review from BillWagner May 19, 2025 19:18
Copilot finished work on behalf of BillWagner May 19, 2025 19:18
@BillWagner
Copy link
Member

You'll find the error codes and the error messages in the roslyn repository.

The new article should go in this folder in the docs repository.

@BillWagner
Copy link
Member

You need to add this article to the toc and update the ms.date value to today's date.

@BillWagner
Copy link
Member

Add a trailing newline so markdown lint doesn't fail.

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 19, 2025

You'll find the error codes and the [error messages](https://github.com/dotnet/roslyn/blob/main/src/Comp...

I've moved the error documentation to the compiler-messages folder as requested. The file is now located in the proper location within the documentation structure.

You need to add this article to the toc and update the ms.date value to today's date.

I've added the CS9036 entry to the TOC in the compiler messages section and updated the ms.date value to today's date (05/19/2023). The changes are in commit bb59f4a.

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 19, 2025

Add a trailing newline so markdown lint doesn't fail.

Added trailing newline to the CS9036 documentation file in commit 8bd831e.

@BillWagner
Copy link
Member

Remove the version in the misc folder, and today is 5/19/2025, not 5/19/2023

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 19, 2025

Remove the version in the misc folder, and today is 5/19/2025, not 5/19/2023

I've removed the duplicate file from the misc folder and updated the ms.date to 05/19/2025. The changes are in commit b7c7151.

Copilot finished work on behalf of BillWagner May 19, 2025 19:28
@BillWagner
Copy link
Member

Two more changes, and this is ready:

  1. Add a final newline at the end of the new cs9036.md file.
  2. Remove the entries for CS9036 in the file for undocumented errors

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.

markdown lint

Copilot finished work on behalf of BillWagner May 20, 2025 14:32
Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 20, 2025

markdown lint

I've fixed the markdown linting issues by removing trailing whitespace from the file in commit 443f2a8. The file now passes markdownlint checks.

Copilot finished work on behalf of BillWagner May 20, 2025 14:37
@BillWagner
Copy link
Member

one more magic OPS build request. Closing and reopening.

@BillWagner BillWagner closed this May 20, 2025
@BillWagner BillWagner reopened this May 20, 2025
@BillWagner BillWagner closed this May 21, 2025
@BillWagner BillWagner reopened this May 21, 2025
@BillWagner BillWagner closed this May 21, 2025
@BillWagner BillWagner reopened this May 21, 2025
@BillWagner BillWagner marked this pull request as ready for review May 23, 2025 13:15
@BillWagner BillWagner requested a review from a team as a code owner May 23, 2025 13:15
@BillWagner BillWagner requested a review from adegeo May 27, 2025 13:58
@BillWagner
Copy link
Member

@adegeo PTAL

Copy link
Contributor

@adegeo adegeo left a comment

Choose a reason for hiding this comment

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

Just one thing to fix.

Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
Copilot finished work on behalf of adegeo May 29, 2025 19:20
@BillWagner BillWagner enabled auto-merge (squash) May 29, 2025 21:40
@BillWagner BillWagner merged commit d029275 into main May 29, 2025
10 checks passed
@BillWagner BillWagner deleted the copilot/fix-46104 branch May 29, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rosyln error CS9036 not described
4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/dotnet/docs/pull/46258

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy