mirror of
https://github.com/cyanfish/naps2.git
synced 2024-08-17 19:20:29 +03:00
Prevent infinite recursion for self-referencing types
This commit is contained in:
parent
939d314a44
commit
2d0c77469d
@ -241,6 +241,9 @@ public abstract class XmlSerializer
|
||||
|
||||
if (typeInfo.CustomSerializer == null)
|
||||
{
|
||||
// Prevent infinite recursion by populating the partial type info
|
||||
// Cycles in type info are ok (e.g. Node.Parent is a Node), just not in the actual objects
|
||||
TypeInfoCache[type] = typeInfo;
|
||||
var knownTypesFromPropertyTypes =
|
||||
props.SelectMany(x => GetTypeInfo(x.PropertyType).KnownTypesByElementName);
|
||||
var knownTypesFromActualType = GetKnownTypes(type);
|
||||
|
Loading…
Reference in New Issue
Block a user