Skip to content

docs: Document CS8080 private accessor override limitation#55014

Open
adegeo with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-override-private-set-property
Open

docs: Document CS8080 private accessor override limitation#55014
adegeo with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-override-private-set-property

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

CS8080 was nearly undocumented—the VS error link led to a "no specifics" page, and the existing docs entry didn't cover the common case that triggers it: a base property with a private accessor.

Changes

  • property-declaration-errors.md — CS8080 bullet: Expanded the existing entry to explain that when the base class property has a private accessor (e.g., private set), an auto-implemented override is impossible because private members aren't accessible in derived classes. Adds explicit guidance to use explicit accessor bodies instead:

    class Base {
        public virtual int Member { get; private set; }
    }
    
    // ❌ CS8080 — auto-implemented can't satisfy the private set
    class Derived : Base {
        public override int Member { get; }
    }
    
    // ✅ Use explicit accessor body instead
    class Derived : Base {
        public override int Member { get => base.Member; }
    }

Internal previews

📄 File 🔗 Preview link
docs/csharp/language-reference/compiler-messages/property-declaration-errors.md docs/csharp/language-reference/compiler-messages/property-declaration-errors

Copilot AI review requested due to automatic review settings July 24, 2026 22:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI linked an issue Jul 24, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix override of property with private set in derived class docs: Document CS8080 private accessor override limitation Jul 24, 2026
Copilot AI requested a review from adegeo July 24, 2026 22:06
Comment thread docs/csharp/language-reference/compiler-messages/property-declaration-errors.md Outdated
Copilot AI requested a review from adegeo July 24, 2026 22:29
@adegeo
adegeo marked this pull request as ready for review July 24, 2026 22:31
@adegeo
adegeo requested review from a team and BillWagner as code owners July 24, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot override property with private set

3 participants