Skip to content

Clarify CA2266 coverage for #:ref directives#54120

Open
Copilot wants to merge 1 commit into
mainfrom
copilot/extend-ca2266-docs
Open

Clarify CA2266 coverage for #:ref directives#54120
Copilot wants to merge 1 commit into
mainfrom
copilot/extend-ca2266-docs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 2, 2026

Corresponding implementation: dotnet/sdk#54553


CA2266 documentation only described entry-point detection in the context of #:include, which left the rule's behavior for #:ref-based file composition unspecified. This update aligns the rule text with analyzer behavior by documenting both directive forms.

  • Rule coverage

    • Updated the CA2266 rule description to say the entry-point file should be distinguishable from files brought in with either #:include or #:ref.
  • Article metadata

    • Refreshed the article date to reflect the documentation update.
#!/usr/bin/env dotnet
#:ref "shared.cs"

Console.WriteLine("Hello");

Internal previews

📄 File 🔗 Preview link
docs/fundamentals/code-analysis/quality-rules/ca2266.md docs/fundamentals/code-analysis/quality-rules/ca2266

Copilot AI self-assigned this Jun 2, 2026
Copilot AI review requested due to automatic review settings June 2, 2026 12:02
Copilot AI review requested due to automatic review settings June 2, 2026 12:02
@jjonescz jjonescz marked this pull request as ready for review June 2, 2026 13:42
Copilot AI review requested due to automatic review settings June 2, 2026 13:42
@jjonescz jjonescz requested review from a team and gewarren as code owners June 2, 2026 13:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Clarifies the CA2266 rule description to indicate the entry-point shebang distinguishes the entry file from files brought in with either #:include or #:ref directives, aligning the docs with the analyzer's actual behavior.

Changes:

  • Updates the rule description to mention #:ref alongside #:include.
  • Refreshes ms.date to 06/02/2026.

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.

4 participants