-Fixed error in JTokenWriter when disposing after adding a duplicate property

-Fixed not validating JSON when deserializing with DataTableConverter
This commit is contained in:
James Newton-King
2014-08-17 19:42:11 +12:00
parent 73a266217b
commit dce6228b8f
5 changed files with 53 additions and 18 deletions
+4 -2
View File
@@ -155,9 +155,11 @@ namespace Newtonsoft.Json.Linq
/// <param name="name">The name of the property.</param>
public override void WritePropertyName(string name)
{
base.WritePropertyName(name);
AddParent(new JProperty(name));
// don't set state until after in case of an error such as duplicate property names
// incorrect state will cause issues if writer is disposed when closing open properties
base.WritePropertyName(name);
}
private void AddValue(object value, JsonToken token)