Skip to content

Commit a8034d2

Browse files
committed
Don't late bind Interface types
1 parent 47075ad commit a8034d2

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

NuGet/lib/ServiceStack.Text.dll

0 Bytes
Binary file not shown.

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.4.8</version>
5+
<version>3.4.9</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/WriteType.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ static WriteType()
3636
if (typeof(T).IsAbstract)
3737
{
3838
WriteTypeInfo = TypeInfoWriter;
39-
CacheFn = WriteAbstractProperties;
39+
if (!typeof(T).IsInterface)
40+
{
41+
CacheFn = WriteAbstractProperties;
42+
}
4043
}
4144
}
4245

@@ -163,7 +166,14 @@ public static void WriteAbstractProperties(TextWriter writer, object value)
163166
writer.Write(JsWriter.EmptyMap);
164167
return;
165168
}
166-
var writeFn = Serializer.GetWriteFn(value.GetType());
169+
var valueType = value.GetType();
170+
if (valueType.IsAbstract)
171+
{
172+
WriteProperties(writer, value);
173+
return;
174+
}
175+
176+
var writeFn = Serializer.GetWriteFn(valueType);
167177
if (!JsConfig<T>.ExcludeTypeInfo) JsState.IsWritingDynamic = true;
168178
writeFn(writer, value);
169179
if (!JsConfig<T>.ExcludeTypeInfo) JsState.IsWritingDynamic = false;

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.4.8.*")]
35+
[assembly: AssemblyVersion("3.4.9.*")]
3636
//[assembly: AssemblyFileVersion("1.0.0.0")]

tests/ServiceStack.Text.Tests/AdhocModelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public class Child
289289
public IParent Parent { get; set; }
290290
}
291291

292-
[Test, Ignore]
292+
[Test]
293293
public void Can_Serailize_Cyclical_Dependency_via_interface()
294294
{
295295
var dto = new Parent {

0 commit comments

Comments
 (0)