From 8af7466ecf5223b713a67a2b3f9027bfa4a6b07b Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Tue, 16 Apr 2024 14:48:55 -0500 Subject: [PATCH] use value kind --- .../Conversations/Services/ConversationStateService.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs index ca731824..636d622e 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs @@ -344,10 +344,12 @@ public class ConversationStateService : IConversationStateService, IDisposable { foreach (JsonProperty property in root.EnumerateObject()) { - var stateValue = property.Value.ToString(); + var propertyValue = property.Value; + var stateValue = propertyValue.ToString(); if (!string.IsNullOrEmpty(stateValue)) { - if (bool.TryParse(stateValue, out _)) + if (propertyValue.ValueKind == JsonValueKind.True || + propertyValue.ValueKind == JsonValueKind.False) { stateValue = stateValue?.ToLower(); }