From cd6d0ee2bb373b175bd91ce687bf75b5c3426541 Mon Sep 17 00:00:00 2001 From: NikolozGob <164164921+NikolozGob@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:27:33 +0400 Subject: [PATCH] Fix: DateTime parsing with InvariantCulture (#1590) Co-authored-by: Nikoloz.Gobejishvili --- src/DotNetCore.CAP/ICapTransaction.Base.cs | 3 ++- src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DotNetCore.CAP/ICapTransaction.Base.cs b/src/DotNetCore.CAP/ICapTransaction.Base.cs index ad778074b..2bf90a2fd 100644 --- a/src/DotNetCore.CAP/ICapTransaction.Base.cs +++ b/src/DotNetCore.CAP/ICapTransaction.Base.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Concurrent; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using DotNetCore.CAP.Messages; @@ -55,7 +56,7 @@ protected virtual void Flush() if (isDelayMessage) { - _dispatcher.EnqueueToScheduler(message, DateTime.Parse(message.Origin.Headers[Headers.SentTime]!)).ConfigureAwait(false); + _dispatcher.EnqueueToScheduler(message, DateTime.Parse(message.Origin.Headers[Headers.SentTime]!, CultureInfo.InvariantCulture)).ConfigureAwait(false); } else diff --git a/src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs b/src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs index 238239ff2..4a0fdffd0 100644 --- a/src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs +++ b/src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using DotNetCore.CAP.Diagnostics; @@ -142,11 +143,11 @@ private async Task PublishInternalAsync(string name, T? value, IDictionary