-Fixed bug when deserializing into existing non-IList collection

This commit is contained in:
James Newton-King
2018-02-11 19:38:12 +13:00
parent 6d3b5077e2
commit 39f2db6f2d
2 changed files with 124 additions and 1 deletions
@@ -912,7 +912,7 @@ namespace Newtonsoft.Json.Serialization
throw JsonSerializationException.Create(reader, "Cannot populate list type {0}.".FormatWith(CultureInfo.InvariantCulture, contract.CreatedType));
}
value = PopulateList((arrayContract.ShouldCreateWrapper) ? arrayContract.CreateWrapper(existingValue) : (IList)existingValue, reader, arrayContract, member, id);
value = PopulateList((arrayContract.ShouldCreateWrapper || !(existingValue is IList)) ? arrayContract.CreateWrapper(existingValue) : (IList)existingValue, reader, arrayContract, member, id);
}
return value;