Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit c9b0c2c

Browse files
committed
Remove Culture specific handling of DateTime's in static constructors
1 parent 57a26a9 commit c9b0c2c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/ServiceStack.Text/Env.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
33

44
using System;
5+
using System.Globalization;
56
using System.IO;
67

78
namespace ServiceStack.Text
@@ -47,9 +48,9 @@ static Env()
4748
+ platformName
4849
+ (IsMono ? "/Mono" : "/.NET");
4950

50-
VersionString = ServiceStackVersion.ToString();
51+
VersionString = ServiceStackVersion.ToString(CultureInfo.InvariantCulture);
5152

52-
__releaseDate = DateTime.Parse("2001-01-01");
53+
__releaseDate = new DateTime(2001,01,01);
5354
}
5455

5556
public static string VersionString { get; set; }

src/ServiceStack.Text/LicenseUtils.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Globalization;
67
using System.IO;
78
using System.Text.RegularExpressions;
9+
using System.Threading;
810
using ServiceStack.Text;
911

1012
namespace ServiceStack
@@ -160,8 +162,11 @@ public static void AssertEvaluationLicense()
160162
public static void RegisterLicense(string licenseKeyText)
161163
{
162164
string cutomerId = null;
165+
var hold = Thread.CurrentThread.CurrentCulture;
166+
163167
try
164168
{
169+
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
165170
var parts = licenseKeyText.SplitOnFirst('-');
166171
cutomerId = parts[0];
167172

@@ -193,6 +198,10 @@ public static void RegisterLicense(string licenseKeyText)
193198

194199
throw new LicenseException(msg).Trace();
195200
}
201+
finally
202+
{
203+
Thread.CurrentThread.CurrentCulture = hold;
204+
}
196205
}
197206

198207
public static void RemoveLicense()
@@ -355,6 +364,7 @@ public static LicenseKey ToLicenseKey(this string licenseKeyText)
355364
{
356365
JsConfig<DateTime>.DeSerializeFn = null;
357366
JsConfig<DateTime>.RawDeserializeFn = null;
367+
358368
var key = jsv.FromJsv<LicenseKey>();
359369

360370
if (key.Ref != refId)

0 commit comments

Comments
 (0)