-Fixed error attempting to deserialize into read-only collections from non-default constructor

This commit is contained in:
James Newton-King
2017-03-05 16:52:58 +13:00
parent 3faacbca3a
commit bed740f76e
4 changed files with 58 additions and 29 deletions
@@ -5031,7 +5031,7 @@ Path '', line 1, position 1.");
JsonTypeReflector.SetFullyTrusted(false);
JsonConvert.DeserializeObject<ISerializableTestObject>("{booleanValue:true}");
}, @"Type 'Newtonsoft.Json.Tests.Serialization.JsonSerializerTest+ISerializableTestObject' implements ISerializable but cannot be deserialized using the ISerializable interface because the current application is not fully trusted and ISerializable can expose secure data." + Environment.NewLine +
}, @"Type 'Newtonsoft.Json.Tests.Serialization.ISerializableTestObject' implements ISerializable but cannot be deserialized using the ISerializable interface because the current application is not fully trusted and ISerializable can expose secure data." + Environment.NewLine +
@"To fix this error either change the environment to be fully trusted, change the application to not deserialize the type, add JsonObjectAttribute to the type or change the JsonSerializer setting ContractResolver to use a new DefaultContractResolver with IgnoreSerializableInterface set to true." + Environment.NewLine +
@"Path 'booleanValue', line 1, position 14.");
}
@@ -5052,7 +5052,7 @@ Path '', line 1, position 1.");
ISerializableTestObject value = new ISerializableTestObject("string!", 0, default(DateTimeOffset), null);
JsonConvert.SerializeObject(value);
}, @"Type 'Newtonsoft.Json.Tests.Serialization.JsonSerializerTest+ISerializableTestObject' implements ISerializable but cannot be serialized using the ISerializable interface because the current application is not fully trusted and ISerializable can expose secure data." + Environment.NewLine +
}, @"Type 'Newtonsoft.Json.Tests.Serialization.ISerializableTestObject' implements ISerializable but cannot be serialized using the ISerializable interface because the current application is not fully trusted and ISerializable can expose secure data." + Environment.NewLine +
@"To fix this error either change the environment to be fully trusted, change the application to not deserialize the type, add JsonObjectAttribute to the type or change the JsonSerializer setting ContractResolver to use a new DefaultContractResolver with IgnoreSerializableInterface set to true." + Environment.NewLine +
@"Path ''.");
}