Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fixed NullRef, serialized DTO can be null #136

merged 1 commit into from

2 participants


Realized that the serializer can return a null DTO string when the service doesn't return a DTO, for instance when it returns an HttpResult.

@mythz mythz merged commit cba794d into ServiceStack:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 14, 2012
  1. @sneal
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/ServiceStack/WebHost.EndPoints/Formats/HtmlFormat.cs
3  src/ServiceStack/WebHost.EndPoints/Formats/HtmlFormat.cs
@@ -41,7 +41,8 @@ public void SerializeToStream(IRequestContext requestContext, object dto, IHttpR
&& httpReq.ResponseContentType != ContentType.JsonReport) return;
// Serialize then escape any potential script tags to avoid XSS when displaying as HTML
- var json = JsonSerializer.SerializeToString(dto).Replace("<", "&lt;").Replace(">", "&gt;");
+ var json = JsonSerializer.SerializeToString(dto) ?? "null";
+ json = json.Replace("<", "&lt;").Replace(">", "&gt;");
var url = httpReq.AbsoluteUri
.Replace("format=html", "")
Something went wrong with that request. Please try again.