Skip to content

Commit

Permalink
Fix threadsafe fail to resolve unit test fail
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Feb 12, 2025
1 parent c7cdedf commit 6491301
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Sentry/SpanTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,14 @@ public void SetTag(string key, string value) =>
public void UnsetTag(string key) =>
(InternalTags ??= new ConcurrentDictionary<string, string>()).TryRemove(key, out _);

private ConcurrentDictionary<string, object?>? _data;
readonly ConcurrentDictionary<string, object?> _data = new();

/// <inheritdoc />
public IReadOnlyDictionary<string, object?> Data =>
_data ??= new ConcurrentDictionary<string, object?>();
public IReadOnlyDictionary<string, object?> Data => _data;

/// <inheritdoc />
public void SetData(string key, object? value) =>
(_data ??= new ConcurrentDictionary<string, object?>())[key] = value;
_data[key] = value;

/// <inheritdoc />
public IReadOnlyDictionary<string, object?> Extra => Data;
Expand Down

0 comments on commit 6491301

Please sign in to comment.