-Added StringEscapeHandling with options to escape HTML and non-ASCII characters

-Added feature to deserialize ISet<T> properties as HashSet<T>
-Fixed ReferenceLoopHandling not being used when serializing ISerializable and dynamic values
This commit is contained in:
James Newton-King
2012-11-18 14:36:00 +13:00
parent f7018719d4
commit e3be3e43db
22 changed files with 515 additions and 38 deletions
@@ -682,8 +682,13 @@ To fix this error either change the environment to be fully trusted, change the
foreach (SerializationEntry serializationEntry in serializationInfo)
{
writer.WritePropertyName(serializationEntry.Name);
SerializeValue(writer, serializationEntry.Value, GetContractSafe(serializationEntry.Value), null, null, member);
JsonContract valueContract = GetContractSafe(serializationEntry.Value);
if (CheckForCircularReference(writer, serializationEntry.Value, null, valueContract, contract, member))
{
writer.WritePropertyName(serializationEntry.Name);
SerializeValue(writer, serializationEntry.Value, valueContract, null, contract, member);
}
}
writer.WriteEndObject();
@@ -736,12 +741,17 @@ To fix this error either change the environment to be fully trusted, change the
{
try
{
string resolvedPropertyName = (contract.PropertyNameResolver != null)
? contract.PropertyNameResolver(memberName)
: memberName;
JsonContract valueContract = GetContractSafe(memberValue);
writer.WritePropertyName(resolvedPropertyName);
SerializeValue(writer, memberValue, GetContractSafe(memberValue), null, null, member);
if (CheckForCircularReference(writer, memberValue, null, valueContract, contract, member))
{
string resolvedPropertyName = (contract.PropertyNameResolver != null)
? contract.PropertyNameResolver(memberName)
: memberName;
writer.WritePropertyName(resolvedPropertyName);
SerializeValue(writer, memberValue, valueContract, null, contract, member);
}
}
catch (Exception ex)
{