From 70b86f1759cc94d5b74b85e564889e703930e7d2 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 20 Dec 2021 12:53:11 +0100 Subject: [PATCH] Update WriteWorkflowExecutionLog.cs Closes #2591 --- .../Elsa.Core/Handlers/WriteWorkflowExecutionLog.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/Elsa.Core/Handlers/WriteWorkflowExecutionLog.cs b/src/core/Elsa.Core/Handlers/WriteWorkflowExecutionLog.cs index 0010c1570..395e83df9 100644 --- a/src/core/Elsa.Core/Handlers/WriteWorkflowExecutionLog.cs +++ b/src/core/Elsa.Core/Handlers/WriteWorkflowExecutionLog.cs @@ -3,9 +3,11 @@ using System.Threading.Tasks; using AutoMapper; using Elsa.Events; using Elsa.Models; +using Elsa.Serialization; using Elsa.Services; using Elsa.Services.Models; using MediatR; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Elsa.Handlers @@ -13,10 +15,12 @@ namespace Elsa.Handlers public class WriteWorkflowExecutionLog : INotificationHandler, INotificationHandler, INotificationHandler { private readonly IMapper _mapper; + private readonly JsonSerializer _jsonSerializer; - public WriteWorkflowExecutionLog(IMapper mapper) + public WriteWorkflowExecutionLog(IMapper mapper, JsonSerializer jsonSerializer) { _mapper = mapper; + _jsonSerializer = jsonSerializer; } public Task Handle(ActivityExecuting notification, CancellationToken cancellationToken) @@ -31,11 +35,11 @@ namespace Elsa.Handlers var data = new JObject { - ["Outcomes"] = JToken.FromObject(activityExecutionContext.Outcomes) + ["Outcomes"] = JToken.FromObject(activityExecutionContext.Outcomes, _jsonSerializer) }; foreach (var entry in activityExecutionContext.JournalData) - data[entry.Key] = entry.Value != null ? JToken.FromObject(entry.Value) : JValue.CreateNull(); + data[entry.Key] = entry.Value != null ? JToken.FromObject(entry.Value, _jsonSerializer) : JValue.CreateNull(); var resuming = activityExecutionContext.Resuming; WriteEntry(resuming ? "Resumed" : "Executed", default, activityExecutionContext, data);