Skip to content
Merged
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
4 changes: 4 additions & 0 deletions src/OpenTelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* Fixed an issue with `HashCode` computations throwing exceptions on .NET
Standard 2.1 targets.
([#4362](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4362))

## 1.5.0-alpha.2

Released 2023-Mar-31
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Metrics/MetricStreamIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public MetricStreamIdentity(Instrument instrument, MetricStreamConfiguration met
this.ExponentialHistogramMaxScale = (metricStreamConfiguration as Base2ExponentialBucketHistogramConfiguration)?.MaxScale ?? 0;
this.HistogramRecordMinMax = (metricStreamConfiguration as HistogramConfiguration)?.RecordMinMax ?? true;

#if NETSTANDARD2_1 || NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
HashCode hashCode = default;
hashCode.Add(this.InstrumentType);
hashCode.Add(this.MeterName);
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Metrics/StringArrayEqualityComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public bool Equals(string[] strings1, string[] strings2)

public int GetHashCode(string[] strings)
{
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
HashCode hashCode = default;
for (int i = 0; i < strings.Length; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Metrics/Tags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Tags(KeyValuePair<string, object>[] keyValuePairs)
{
this.KeyValuePairs = keyValuePairs;

#if NETSTANDARD2_1 || NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
HashCode hashCode = default;
for (int i = 0; i < this.KeyValuePairs.Length; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Trace/SamplingResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public override bool Equals(object? obj)
/// <inheritdoc/>
public override int GetHashCode()
{
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
HashCode hashCode = default;
hashCode.Add(this.Decision);
hashCode.Add(this.Attributes);
Expand Down