-Changed LINQ to JSON load methods to support reading past preceding comments

This commit is contained in:
James Newton-King
2012-07-16 00:01:40 +12:00
parent 55a09d2f73
commit 5d83daa804
8 changed files with 38 additions and 3 deletions
+6
View File
@@ -229,6 +229,12 @@ namespace Newtonsoft.Json.Linq
if (!reader.Read())
throw JsonReaderException.Create(reader, "Error reading JProperty from JsonReader.");
}
while (reader.TokenType == JsonToken.Comment)
{
reader.Read();
}
if (reader.TokenType != JsonToken.PropertyName)
throw JsonReaderException.Create(reader, "Error reading JProperty from JsonReader. Current JsonReader item is not a property: {0}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType));