* Apply fix to #1460 to async writing. * Replace recursion with iteration. * Test for 1460 in async use. * Change infinite loop style.
This commit is contained in:
committed by
James Newton-King
parent
3ea750d6d6
commit
1b40ebfe26
@@ -353,24 +353,20 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
private static bool InheritsGenericDefinitionInternal(Type currentType, Type genericClassDefinition, out Type implementingType)
|
||||
{
|
||||
if (currentType.IsGenericType())
|
||||
do
|
||||
{
|
||||
Type currentGenericClassDefinition = currentType.GetGenericTypeDefinition();
|
||||
|
||||
if (genericClassDefinition == currentGenericClassDefinition)
|
||||
if (currentType.IsGenericType() && genericClassDefinition == currentType.GetGenericTypeDefinition())
|
||||
{
|
||||
implementingType = currentType;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentType.BaseType() == null)
|
||||
{
|
||||
implementingType = null;
|
||||
return false;
|
||||
currentType = currentType.BaseType();
|
||||
}
|
||||
while (currentType != null);
|
||||
|
||||
return InheritsGenericDefinitionInternal(currentType.BaseType(), genericClassDefinition, out implementingType);
|
||||
implementingType = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user