Skip to content

Commit 5fad57d

Browse files
Merge branch 'main' into renovate-prep
2 parents 4729aa5 + 4647362 commit 5fad57d

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

.github/workflows/ossf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
persist-credentials: false
2525

26-
- uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
26+
- uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
2727
with:
2828
results_file: results.sarif
2929
results_format: sarif

src/OpenTelemetry.OpAmp.Client/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
* Drop reference to `System.Collections.Immutable`.
6+
([#3154](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3154))
7+
58
## 0.1.0-alpha.1
69

710
Released 2025-Sep-23

src/OpenTelemetry.OpAmp.Client/Internal/FrameProcessor.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Buffers;
55
using System.Collections.Concurrent;
6-
using System.Collections.Immutable;
76
using OpAmp.Proto.V1;
87
using OpenTelemetry.Internal;
98
using OpenTelemetry.OpAmp.Client.Internal.Listeners;
@@ -14,7 +13,7 @@ namespace OpenTelemetry.OpAmp.Client.Internal;
1413

1514
internal sealed class FrameProcessor
1615
{
17-
private readonly ConcurrentDictionary<Type, ImmutableList<IOpAmpListener>> listeners = [];
16+
private readonly ConcurrentDictionary<Type, IReadOnlyList<IOpAmpListener>> listeners = [];
1817

1918
public void Subscribe<T>(IOpAmpListener<T> listener)
2019
where T : IOpAmpMessage
@@ -25,7 +24,13 @@ public void Subscribe<T>(IOpAmpListener<T> listener)
2524
this.listeners.AddOrUpdate(
2625
typeof(T),
2726
_ => [listener],
28-
(_, list) => list.Add(listener));
27+
(_, list) =>
28+
{
29+
var newList = new List<IOpAmpListener>(list.Count + 1);
30+
newList.AddRange(list);
31+
newList.Add(listener);
32+
return newList;
33+
});
2934
}
3035

3136
public void Unsubscribe<T>(IOpAmpListener<T> listener)
@@ -35,15 +40,15 @@ public void Unsubscribe<T>(IOpAmpListener<T> listener)
3540

3641
this.listeners.AddOrUpdate(
3742
typeof(T),
38-
_ => ImmutableList<IOpAmpListener>.Empty,
43+
_ => [],
3944
(_, list) =>
4045
{
4146
if (list.Count == 1 && list[0] == listener)
4247
{
43-
return ImmutableList<IOpAmpListener>.Empty;
48+
return [];
4449
}
4550

46-
return list.Remove(listener);
51+
return list.Where(x => x != listener).ToList();
4752
});
4853
}
4954

src/OpenTelemetry.OpAmp.Client/OpenTelemetry.OpAmp.Client.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
<!-- .NET Framework supporting packages -->
2222
<ItemGroup Condition="'$([MSBuild]::GetTargetFrameworkIdentifier(`$(TargetFramework)`))' == '.NETFramework'">
2323
<PackageReference Include="System.Net.Http" />
24-
<PackageReference Include="System.Collections.Immutable" />
25-
</ItemGroup>
26-
27-
<!-- .NET Standard supporting packages -->
28-
<ItemGroup Condition="'$([MSBuild]::GetTargetFrameworkIdentifier(`$(TargetFramework)`))' == '.NETStandard'">
29-
<PackageReference Include="System.Collections.Immutable" />
3024
</ItemGroup>
3125

3226
<ItemGroup>

0 commit comments

Comments
 (0)