diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj
index 638b89e9..090b1369 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj
@@ -91,6 +91,7 @@
+
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
index a8938eac..661e7e57 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
@@ -76,6 +76,7 @@
+
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj
index 773b54e2..0e158db7 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj
@@ -102,6 +102,7 @@
+
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
index 56ffcedf..9208f68b 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
@@ -118,6 +118,7 @@
+
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs
index f661df44..ec3c40e3 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs
@@ -280,10 +280,42 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.IsInstanceOfType(typeof(SendHttpRequest), message);
- SendHttpRequest request = (SendHttpRequest) message;
+ SendHttpRequest request = (SendHttpRequest)message;
Assert.AreEqual("xyz", request.CorrelationId);
Assert.AreEqual(2, request.RequestData.Count);
Assert.AreEqual("siedemnaĆcie", request.RequestData["Id"]);
}
+
+ [Test]
+ public void SerializeObjectWithMultipleGenericLists()
+ {
+ string containerTypeName = typeof(Container).AssemblyQualifiedName;
+ string productTypeName = typeof(Product).AssemblyQualifiedName;
+
+ Container container = new Container
+ {
+ In = new List(),
+ Out = new List()
+ };
+
+ string json = JsonConvert.SerializeObject(container, Formatting.Indented,
+ new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore,
+ TypeNameHandling = TypeNameHandling.All
+ });
+
+ Assert.AreEqual(@"{
+ ""$type"": """ + containerTypeName + @""",
+ ""In"": {
+ ""$type"": ""System.Collections.Generic.List`1[[" + productTypeName + @"]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"",
+ ""$values"": []
+ },
+ ""Out"": {
+ ""$type"": ""System.Collections.Generic.List`1[[" + productTypeName + @"]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"",
+ ""$values"": []
}
-}
+}", json);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Container.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Container.cs
new file mode 100644
index 00000000..4fea347f
--- /dev/null
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/Container.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace Newtonsoft.Json.Tests.TestObjects
+{
+ public class Container
+ {
+ public IList In { get; set; }
+ public IList Out { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
index 38dd3e57..fc07969c 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
@@ -399,7 +399,7 @@ namespace Newtonsoft.Json.Serialization
writer.WriteEndArray();
- if (isReference)
+ if (isReference || includeTypeDetails)
{
writer.WriteEndObject();
}