From a3730808aaa28819aeb31706ed4fa9ed6450d6f4 Mon Sep 17 00:00:00 2001 From: Michael Gregson <18532345+michaelgregson@users.noreply.github.com> Date: Fri, 30 Jul 2021 17:25:07 +0100 Subject: [PATCH] Serialize properties in derived classes System.Text.Json serializes based on static type of value parameter. Polymorphic serialization requires type information --- .../EventBus/EventBusServiceBus/EventBusServiceBus.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs index 84229b238..60d97d523 100644 --- a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs @@ -35,7 +35,7 @@ public void Publish(IntegrationEvent @event) { var eventName = @event.GetType().Name.Replace(INTEGRATION_EVENT_SUFFIX, ""); - var jsonMessage = JsonSerializer.Serialize(@event); + var jsonMessage = JsonSerializer.Serialize(@event, @event.GetType()); var body = Encoding.UTF8.GetBytes(jsonMessage); var message = new Message