Skip to content

Fix heartbeat telemetry serialization of nested objects#2032

Open
tyrielv wants to merge 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/fix-eventmetadata-serialization
Open

Fix heartbeat telemetry serialization of nested objects#2032
tyrielv wants to merge 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/fix-eventmetadata-serialization

Conversation

@tyrielv

@tyrielv tyrielv commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Problem

In GVFS 2.0.26162.1, the VFS.Heartbeat event's payload has a serialization regression. Fields that should contain structured data (FilePlaceholderCreation, FolderPlaceholderCreation, FilePlaceholdersHydrated, PhysicalDiskInfo) are serialized as .NET type names instead of their key-value contents:

{
  "FilePlaceholderCreation": "GVFS.Common.Tracing.EventMetadata",
  "PhysicalDiskInfo": "System.Collections.Generic.Dictionary\2[System.String,System.String]"
}

Root Cause

EventMetadataConverter.WriteValue() had no pattern-match cases for nested EventMetadata or Dictionary<string, string> values. Both fell through to default: writer.WriteStringValue(value.ToString()), which produces the type name.

Fix

Added two case arms before the default fall-through:

  • EventMetadata nested — recursively serializes as a JSON object
  • IDictionary<string, string> dict — serializes as a flat string-to-string JSON object

Testing

Added EventMetadataConverterTests with 4 test cases covering nested EventMetadata, Dictionary<string, string>, empty nested objects, and primitive value passthrough. All pass.

EventMetadataConverter.WriteValue() was falling through to the default
case (ToString()) for EventMetadata and Dictionary<string, string> values,
producing type names like "GVFS.Common.Tracing.EventMetadata" instead of
their key-value contents in the VFS.Heartbeat payload.

Add pattern-match cases for EventMetadata (recursive) and
IDictionary<string, string> so nested objects serialize as JSON objects.

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv tyrielv force-pushed the tyrielv/fix-eventmetadata-serialization branch from 31309b1 to e1854be Compare June 18, 2026 23:50
@tyrielv tyrielv marked this pull request as ready for review June 18, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant