diff --git a/src/core/CloudStreams.Core.Application/Extensions/CloudEventRecordExtensions.cs b/src/core/CloudStreams.Core.Application/Extensions/CloudEventRecordExtensions.cs index 5226e77..cb51d2e 100644 --- a/src/core/CloudStreams.Core.Application/Extensions/CloudEventRecordExtensions.cs +++ b/src/core/CloudStreams.Core.Application/Extensions/CloudEventRecordExtensions.cs @@ -30,7 +30,7 @@ public static class CloudEventRecordExtensions public static CloudEvent ToCloudEvent(this CloudEventDescriptor descriptor) { ArgumentNullException.ThrowIfNull(descriptor); - var e = (JsonObject)JsonSerializer.Default.SerializeToNode(descriptor.Metadata.ContextAttributes.Where(a => a.Key.IsLowercased() && a.Key.IsAlphanumeric()))!; + var e = (JsonObject)JsonSerializer.Default.SerializeToNode(descriptor.Metadata.ContextAttributes.Where(a => a.Key.IsLowercased() && a.Key.IsAlphanumeric()).ToDictionary(kvp => kvp.Key, kvp => kvp.Value))!; var data = JsonSerializer.Default.SerializeToNode(descriptor.Data); e[CloudEventAttributes.Data] = data; return JsonSerializer.Default.Deserialize(e)!;