Skip to content

Commit 010101a

Browse files
Merge branch 'main' into fix/#3461
2 parents 5682e34 + b283298 commit 010101a

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
### Fixes
1111
- Fixed JNI Error when accessing Android device data from multiple threads ([#3802](https://github.com/getsentry/sentry-dotnet/pull/3802))
1212
- Android - fix bug that prevents logcat.log from getting attached to unhandled events (SIGSEGV Segfault) ([#3694](https://github.com/getsentry/sentry-dotnet/pull/3694))
13+
- Fix "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'idData')" error propagating OpenTelemetry span ids ([#3850](https://github.com/getsentry/sentry-dotnet/pull/3850))
1314

1415
### Dependencies
1516

src/Sentry/SpanId.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace Sentry;
4141
public override int GetHashCode() => StringComparer.Ordinal.GetHashCode(_value);
4242

4343
/// <inheritdoc />
44-
public override string ToString() => _value.ToString("x8");
44+
public override string ToString() => _value.ToString("x8").PadLeft(16, '0');
4545

4646
/// <summary>
4747
/// Generates a new Sentry ID.

test/Sentry.Tests/Protocol/Context/TraceTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,15 @@ public void Clone_CopyValues()
8585
Assert.Equal(trace.SpanId, clone.SpanId);
8686
Assert.Equal(trace.TraceId, clone.TraceId);
8787
}
88+
89+
[Fact]
90+
public void SpanId_LeadingZero_ToStringValid()
91+
{
92+
// Arrange
93+
const string spanIdInput = "0ecd6f15f72015cb";
94+
var spanId = new SpanId(spanIdInput);
95+
96+
// Assert
97+
Assert.Equal(spanIdInput, spanId.ToString());
98+
}
8899
}

0 commit comments

Comments
 (0)