Skip to content
Merged
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,23 @@ public override IActivity Read(ref Utf8JsonReader reader, Type typeToConvert, Js
notFoundActivity.MissingTypeName = activityTypeName;
notFoundActivity.MissingTypeVersion = activityTypeVersion;
notFoundActivity.OriginalActivityJson = activityRoot.ToString();

// Extract and copy metadata from the outer NotFoundActivity JSON wrapper (doc.RootElement).
// Note: activityRoot may contain the inner originalActivityJson, so we must read from doc.RootElement
// to get the metadata that was added to the NotFoundActivity wrapper itself.
Comment thread
sfmskywalker marked this conversation as resolved.
Outdated
if (doc.RootElement.TryGetProperty("metadata", out var outerMetadataElement))
{
var outerMetadata = JsonSerializer.Deserialize<IDictionary<string, object>>(outerMetadataElement.GetRawText(), clonedOptions);
if (outerMetadata != null)
{
notFoundActivity.Metadata = outerMetadata;
}
}

// Set display text and description after metadata assignment to ensure they always reflect the current state
notFoundActivity.SetDisplayText($"Not Found: {activityTypeName}");
notFoundActivity.SetDescription($"Could not find activity type {activityTypeName} with version {activityTypeVersion}");

return notFoundActivity;
}

Expand Down