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

Commit 6af63ea

Browse files
committed
Fix multi-threading issue of shared captured variable
1 parent 5865256 commit 6af63ea

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/ServiceStack.Text/Common/DeserializeBuiltin.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ private static ParseStringDelegate GetParseFn()
7070
case TypeCode.DateTime:
7171
return value => DateTimeSerializer.ParseShortestXsdDateTime(value);
7272
case TypeCode.Char:
73-
char cValue;
74-
return value => char.TryParse(value, out cValue) ? cValue : '\0';
73+
return value => {
74+
char cValue;
75+
return char.TryParse(value, out cValue) ? cValue : '\0';
76+
};
7577
}
7678

7779
if (typeof(T) == typeof(Guid))
@@ -120,8 +122,10 @@ private static ParseStringDelegate GetParseFn()
120122
case TypeCode.DateTime:
121123
return value => DateTimeSerializer.ParseShortestNullableXsdDateTime(value);
122124
case TypeCode.Char:
123-
char cValue;
124-
return value => string.IsNullOrEmpty(value) ? (char?)null : char.TryParse(value, out cValue) ? cValue : '\0';
125+
return value => {
126+
char cValue;
127+
return string.IsNullOrEmpty(value) ? (char?)null : char.TryParse(value, out cValue) ? cValue : '\0';
128+
};
125129
}
126130

127131
if (typeof(T) == typeof(TimeSpan?))

0 commit comments

Comments
 (0)