Skip to content

Span.SetData("my.array", new string[] { /* some data */ }) is incorrectly serialized as an empty objectΒ #5135

@maxkatz6

Description

@maxkatz6

Package

Sentry

.NET Flavor

.NET

.NET Version

10.0.203

OS

Windows

OS Version

No response

Development Environment

Rider 2025.x (Windows)

Other Error Monitoring Solution

No

Other Error Monitoring Solution Name

No response

SDK Version

10.0

Self-Hosted Sentry Version

No response

Workload Versions

UseSentry or SentrySdk.Init call

// Should be unrelated to the issue
_initDisposable = SentrySdk.Init(o =>
{
    o.Dsn = sentryKey;
    o.CacheDirectoryPath = /* */;
    o.IsGlobalModeEnabled = true;
    o.TracesSampleRate = 1.0;
    o.AddExceptionFilterForType<OperationCanceledException>();
    o.DisableDiagnosticSourceIntegration();
    o.DisableSystemDiagnosticsMetricsIntegration();
    o.DisableWinUiUnhandledExceptionIntegration();
});

Steps to Reproduce

  1. Start a span
  2. Call Span.SetData("my.array", ["test1", "test2", "test3").
  3. Finish the span, flush
  4. Find the span in the dashboard and observer raw JSON or empty value in the table

I tried to find the issue in the code, if it's obvious, and it seems to be due to missing array branch in the WriteDynamicValue method here

public static void WriteDynamicValue(

I noticed this method has branches for dictionaries and some other complex type but not arrays.
And I also found there a workaround for my issue - implement a simple ISentryJsonSerializable wrapper.

Expected Result

"data" {
   "my.array": [
      "test1", "test2", "test3"
   ]
}

Actual Result

"data" {
   "my.array": { }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions