Skip to content

Replace outdated Array.Empty comments with correct reason#123862

Merged
stephentoub merged 5 commits intomainfrom
copilot/update-array-empty-comment
Feb 2, 2026
Merged

Replace outdated Array.Empty comments with correct reason#123862
stephentoub merged 5 commits intomainfrom
copilot/update-array-empty-comment

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

Description

Addresses PR #123854 comment: replaces comments citing "Array.Empty() doesn't exist in all configurations" with the actual reason for using new T[0].

Changes

Updated pragma warning comments in 3 files:

  • System.Diagnostics.DiagnosticSource/Activity.cs
  • System.Threading.Tasks.Dataflow/Internal/ImmutableArray.cs
  • System.Collections.Immutable/ImmutableArray_1.Minimal.cs

Before:

#pragma warning disable CA1825 // Array.Empty<T>() doesn't exist in all configurations

After:

#pragma warning disable CA1825 // avoid the extra generic instantiation for Array.Empty<T>()

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 1, 2026 22:16
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot AI changed the title [WIP] Update comment regarding Array.Empty availability Replace outdated Array.Empty comments with correct reason Feb 1, 2026
Copilot AI requested a review from stephentoub February 1, 2026 22:18
@stephentoub stephentoub marked this pull request as ready for review February 1, 2026 22:24
Copilot AI review requested due to automatic review settings February 1, 2026 22:24
Copy link
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

This PR addresses a comment from PR #123854 by updating outdated pragma warning comments that incorrectly stated "Array.Empty() doesn't exist in all configurations" with the actual reason: avoiding the extra generic instantiation for Array.Empty().

Changes:

  • Updated pragma warning disable comments in three files to reflect the correct reason for using new T[0] instead of Array.Empty<T>()

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/libraries/System.Threading.Tasks.Dataflow/src/Internal/ImmutableArray.cs Updated CA1825 pragma comment from outdated "doesn't exist in all configurations" to "avoid the extra generic instantiation for Array.Empty()"
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs Updated CA1825 pragma comment with the same correction
src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs Replaced two-line comment with single-line comment explaining the reason is to avoid extra generic instantiation

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.

4 participants