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

Commit 7984fca

Browse files
committed
Ensure static initializers are run
1 parent 87cfdab commit 7984fca

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/ServiceStack.Text/JsConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ static JsConfig()
2222
LicenseUtils.Init();
2323
}
2424

25+
internal static void InitStatics() {}
26+
2527
public static JsConfigScope BeginScope()
2628
{
2729
return new JsConfigScope();

src/ServiceStack.Text/Json/JsonReader.Generic.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ static JsonReader()
5050

5151
public static void Refresh()
5252
{
53+
JsConfig.InitStatics();
54+
5355
if (JsonReader.Instance == null)
5456
return;
5557

@@ -78,6 +80,8 @@ public static object Parse(string value)
7880
throw new NotSupportedException("Can not deserialize interface type: "
7981
+ typeof(T).Name);
8082
}
83+
84+
Refresh();
8185
}
8286

8387
return value == null

src/ServiceStack.Text/Jsv/JsvReader.Generic.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace ServiceStack.Text.Jsv
1010
{
1111
public static class JsvReader
12-
{
12+
{
1313
internal static readonly JsReader<JsvTypeSerializer> Instance = new JsReader<JsvTypeSerializer>();
1414

1515
private static Dictionary<Type, ParseFactoryDelegate> ParseFnCache = new Dictionary<Type, ParseFactoryDelegate>();
@@ -50,6 +50,8 @@ static JsvReader()
5050

5151
public static void Refresh()
5252
{
53+
JsConfig.InitStatics();
54+
5355
if (JsvReader.Instance == null)
5456
return;
5557

@@ -72,8 +74,11 @@ public static object Parse(string value)
7274
throw new NotSupportedException("Can not deserialize interface type: "
7375
+ typeof(T).Name);
7476
}
75-
}
76-
return value == null
77+
78+
Refresh();
79+
}
80+
81+
return value == null
7782
? null
7883
: ReadFn(value);
7984
}

0 commit comments

Comments
 (0)