From 0ae8d610992dd544b5e77a96d189e5b615cbd8e0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 22:12:33 +0000 Subject: [PATCH 1/5] Initial plan From 57e9508c37b2a23184ca34a3f1c44f2bc47ad292 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 22:16:48 +0000 Subject: [PATCH 2/5] Replace outdated Array.Empty comments with the correct reason Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> --- .../System/Collections/Immutable/ImmutableArray_1.Minimal.cs | 4 ++-- .../src/System/Diagnostics/Activity.cs | 2 +- .../src/Internal/ImmutableArray.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs index 72f5aece86c449..65a8a94cd81a6e 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs @@ -39,8 +39,8 @@ public partial struct ImmutableArray : IEnumerable, IEquatable. /// #pragma warning disable CA1825 - // Array.Empty() doesn't exist in all configurations - // Switching to Array.Empty also has a non-negligible impact on the working set memory + // Avoid the extra generic instantiation for Array.Empty(); + // switching to Array.Empty also has a non-negligible impact on the working set memory public static readonly ImmutableArray Empty = new ImmutableArray(new T[0]); #pragma warning restore CA1825 diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs index 4cdd8c546bd147..cd6da7a53f818d 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs @@ -58,7 +58,7 @@ internal ActivityChangedEventArgs(Activity? previous, Activity? current) [DebuggerTypeProxy(typeof(ActivityDebuggerProxy))] public partial class Activity : IDisposable { -#pragma warning disable CA1825 // Array.Empty() doesn't exist in all configurations +#pragma warning disable CA1825 // avoid the extra generic instantiation for Array.Empty() private static readonly IEnumerable> s_emptyBaggageTags = new KeyValuePair[0]; private static readonly IEnumerable> s_emptyTagObjects = new KeyValuePair[0]; private static readonly IEnumerable s_emptyLinks = new DiagLinkedList(); diff --git a/src/libraries/System.Threading.Tasks.Dataflow/src/Internal/ImmutableArray.cs b/src/libraries/System.Threading.Tasks.Dataflow/src/Internal/ImmutableArray.cs index 432ec82566dc55..c2ac5e6117da0c 100644 --- a/src/libraries/System.Threading.Tasks.Dataflow/src/Internal/ImmutableArray.cs +++ b/src/libraries/System.Threading.Tasks.Dataflow/src/Internal/ImmutableArray.cs @@ -25,7 +25,7 @@ namespace System.Threading.Tasks.Dataflow.Internal internal readonly struct ImmutableArray { /// An empty array. -#pragma warning disable CA1825 // Array.Empty() doesn't exist in all configurations +#pragma warning disable CA1825 // avoid the extra generic instantiation for Array.Empty() private static readonly ImmutableArray s_empty = new ImmutableArray(new T[0]); #pragma warning restore CA1825 /// The immutable data in this array instance. From cc91a324e8029b903eedffa5fc8f2c37828133fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 22:17:14 +0000 Subject: [PATCH 3/5] Fix capitalization consistency in comment Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> --- .../System/Collections/Immutable/ImmutableArray_1.Minimal.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs index 65a8a94cd81a6e..0d91394da514f0 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs @@ -40,7 +40,7 @@ public partial struct ImmutableArray : IEnumerable, IEquatable #pragma warning disable CA1825 // Avoid the extra generic instantiation for Array.Empty(); - // switching to Array.Empty also has a non-negligible impact on the working set memory + // Switching to Array.Empty also has a non-negligible impact on the working set memory public static readonly ImmutableArray Empty = new ImmutableArray(new T[0]); #pragma warning restore CA1825 From 3847202daefa94e522740da589b75bf5b14ef823 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sun, 1 Feb 2026 17:24:30 -0500 Subject: [PATCH 4/5] Update src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs --- .../src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs index 0d91394da514f0..2e8a2b346b0c50 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs @@ -40,7 +40,6 @@ public partial struct ImmutableArray : IEnumerable, IEquatable #pragma warning disable CA1825 // Avoid the extra generic instantiation for Array.Empty(); - // Switching to Array.Empty also has a non-negligible impact on the working set memory public static readonly ImmutableArray Empty = new ImmutableArray(new T[0]); #pragma warning restore CA1825 From d36a043c1b77a1124992fb8ff2c2a346b7faa1d0 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sun, 1 Feb 2026 17:37:16 -0500 Subject: [PATCH 5/5] Update src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs --- .../System/Collections/Immutable/ImmutableArray_1.Minimal.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs index 2e8a2b346b0c50..60d61cead0d882 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs @@ -39,7 +39,7 @@ public partial struct ImmutableArray : IEnumerable, IEquatable. /// #pragma warning disable CA1825 - // Avoid the extra generic instantiation for Array.Empty(); + // Avoid the extra generic instantiation for Array.Empty() public static readonly ImmutableArray Empty = new ImmutableArray(new T[0]); #pragma warning restore CA1825