Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public partial struct ImmutableArray<T> : IEnumerable<T>, IEquatable<ImmutableAr
/// <summary>
/// An empty (initialized) instance of <see cref="ImmutableArray{T}"/>.
/// </summary>
#pragma warning disable CA1825
// Array.Empty<T>() doesn't exist in all configurations
// Switching to Array.Empty also has a non-negligible impact on the working set memory
#pragma warning disable CA1825 // avoid the extra generic instantiation for Array.Empty<T>()
public static readonly ImmutableArray<T> Empty = new ImmutableArray<T>(new T[0]);
#pragma warning restore CA1825

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ internal ActivityChangedEventArgs(Activity? previous, Activity? current)
/// </summary>
public partial class Activity : IDisposable
{
#pragma warning disable CA1825 // Array.Empty<T>() doesn't exist in all configurations
#pragma warning disable CA1825 // avoid the extra generic instantiation for Array.Empty<T>()
private static readonly IEnumerable<KeyValuePair<string, string?>> s_emptyBaggageTags = new KeyValuePair<string, string?>[0];
private static readonly IEnumerable<KeyValuePair<string, object?>> s_emptyTagObjects = new KeyValuePair<string, object?>[0];
#pragma warning restore CA1825
private static readonly IEnumerable<ActivityLink> s_emptyLinks = new DiagLinkedList<ActivityLink>();
private static readonly IEnumerable<ActivityEvent> s_emptyEvents = new DiagLinkedList<ActivityEvent>();
#pragma warning restore CA1825
private static readonly ActivitySource s_defaultSource = new ActivitySource(string.Empty);
private static readonly AsyncLocal<Activity?> s_current = new AsyncLocal<Activity?>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void GetObjectData(SerializationInfo info, StreamingContext context)

if (m_localValues == null || AsyncLocalValueMap.IsEmpty(m_localValues))
{
#pragma warning disable CA1825, IDE0300 // Avoid unnecessary zero-length array allocations
#pragma warning disable CA1825, IDE0300 // avoid the extra generic instantiation for Array.Empty<T>()
return isFlowSuppressed ?
(s_defaultFlowSuppressed ??= new ExecutionContext(AsyncLocalValueMap.Empty, new IAsyncLocal[0], isFlowSuppressed: true)) :
null; // implies the default context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace System.Threading.Tasks.Dataflow.Internal
internal readonly struct ImmutableArray<T>
{
/// <summary>An empty array.</summary>
#pragma warning disable CA1825 // Array.Empty<T>() doesn't exist in all configurations
#pragma warning disable CA1825 // avoid the extra generic instantiation for Array.Empty<T>()
private static readonly ImmutableArray<T> s_empty = new ImmutableArray<T>(new T[0]);
#pragma warning restore CA1825
/// <summary>The immutable data in this array instance.</summary>
Expand Down