Skip to content

Commit d8040ab

Browse files
committed
Fixed trailing backslash, INCR to v3.63
1 parent 9a64695 commit d8040ab

5 files changed

Lines changed: 39 additions & 7 deletions

File tree

NuGet/servicestack.text.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
33
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
44
<id>ServiceStack.Text</id>
5-
<version>3.6.0</version>
5+
<version>3.6.3</version>
66
<authors>Demis Bellot</authors>
77
<owners>Demis Bellot</owners>
88
<summary>.NET's fastest JSON, JSV and CSV Text Serializers (3x faster than JSON.NET)</summary>

src/ServiceStack.Text/Common/DeserializeDictionary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static IDictionary<TKey, TValue> ParseDictionary<TKey, TValue>(
9393

9494
var to = (createMapType == null)
9595
? new Dictionary<TKey, TValue>()
96-
: (IDictionary<TKey, TValue>)ReflectionExtensions.CreateInstance(createMapType);
96+
: (IDictionary<TKey, TValue>)createMapType.CreateInstance();
9797

9898
if (value == JsWriter.EmptyMap) return to;
9999

src/ServiceStack.Text/Json/JsonTypeSerializer.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,13 @@ public string EatValue(string value, ref int i)
492492
{
493493
valueChar = value[i];
494494

495-
if (valueChar == JsWriter.QuoteChar
496-
&& value[i - 1] != JsonUtils.EscapeChar)
495+
if (valueChar == JsonUtils.EscapeChar)
496+
{
497+
i++;
498+
continue;
499+
}
500+
501+
if (valueChar == JsWriter.QuoteChar)
497502
withinQuotes = !withinQuotes;
498503

499504
if (withinQuotes)
@@ -513,8 +518,13 @@ public string EatValue(string value, ref int i)
513518
{
514519
valueChar = value[i];
515520

516-
if (valueChar == JsWriter.QuoteChar
517-
&& value[i - 1] != JsonUtils.EscapeChar)
521+
if (valueChar == JsonUtils.EscapeChar)
522+
{
523+
i++;
524+
continue;
525+
}
526+
527+
if (valueChar == JsWriter.QuoteChar)
518528
withinQuotes = !withinQuotes;
519529

520530
if (withinQuotes)

src/ServiceStack.Text/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.6.0.*")]
35+
[assembly: AssemblyVersion("3.6.3.*")]
3636
//[assembly: AssemblyFileVersion("1.0.0.0")]

tests/ServiceStack.Text.Tests/ReportedIssues.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
34
using NUnit.Framework;
45
using ServiceStack.ServiceInterface.ServiceModel;
@@ -232,5 +233,26 @@ public void Objects_Do_Not_Survive_RoundTrips_Via_StringStringDictionary_Due_To_
232233
Assert.AreEqual(book.Title, fromJsonViaDictionary.Title);
233234
Assert.AreEqual(book.CategoryId, fromJsonViaDictionary.CategoryId);
234235
}
236+
237+
public class Test
238+
{
239+
public IDictionary<string, string> Items { get; set; }
240+
public string TestString { get; set; }
241+
}
242+
243+
[Test]
244+
public void Does_Trailing_Backslashes()
245+
{
246+
var test = new Test {
247+
TestString = "Test",
248+
Items = new Dictionary<string, string> { { "foo", "bar\\" } }
249+
};
250+
251+
var serialized = JsonSerializer.SerializeToString(test);
252+
Console.WriteLine(serialized);
253+
var deserialized = JsonSerializer.DeserializeFromString<Test>(serialized);
254+
255+
Assert.That(deserialized.TestString, Is.EqualTo("Test")); // deserialized.TestString is NULL
256+
}
235257
}
236258
}

0 commit comments

Comments
 (0)