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

Commit 14c887a

Browse files
committed
Only recursively populate Class types that aren't strings
1 parent 46fbd62 commit 14c887a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ServiceStack.Text/ReflectionExtensions.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1991,7 +1991,15 @@ public static Dictionary<string, object> ToSafePartialObjectDictionary<T>(this T
19911991
{
19921992
foreach (var entry in propValues)
19931993
{
1994-
if (!TypeSerializer.HasCircularReferences(entry.Value))
1994+
var valueType = entry.Value != null
1995+
? entry.Value.GetType()
1996+
: null;
1997+
1998+
if (valueType == null || !valueType.IsClass || valueType == typeof(string))
1999+
{
2000+
to[entry.Key] = entry.Value;
2001+
}
2002+
else if (!TypeSerializer.HasCircularReferences(entry.Value))
19952003
{
19962004
to[entry.Key] = entry.Value.ToSafePartialObjectDictionary();
19972005
}

0 commit comments

Comments
 (0)