ArgumentOutOfRangeException

Have just started getting this on a subset of json format calls. Kind of strange, I don’t think it came directly after an upgrade of ServiceStack or Xamarin. Does not seem to affect other formats e.g. html or xml. Does not affect all calls. This particular api call doesn’t do much, just plays back the log4net log as text. It outputs most of the api response and then spews out the below. service implementation is below

I am running latest servicestack and xamarin bits.

{“ResponseStatus”:{“ErrorCode”:“ArgumentOutOfRangeException”,“Message”:“Specified argument was out of the range of valid values.\nParameter name: offset”,“StackTrace”:" at System.Web.HttpResponseStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00031] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Web/System.Web/HttpResponseStream.cs:459 \n at ServiceStack.Text.DirectStreamWriter.Write (System.String s) [0x00034] in <5d202dc8fb8f479ba5bbea3e08634e28>:0 \n at ServiceStack.Text.Json.JsonUtils.WriteString (System.IO.TextWriter writer, System.String value) [0x0002c] in <5d202dc8fb8f479ba5bbea3e08634e28>:0 \n at ServiceStack.Text.Json.JsonTypeSerializer.WriteString (System.IO.TextWriter writer, System.String value) [0x00000] in <5d202dc8fb8f479ba5bbea3e08634e28>:0 \n at ServiceStack.Text.Common.WriteLists.WriteListString (ServiceStack.Text.Common.ITypeSerializer serializer, System.IO.TextWriter writer, System.Collections.Generic.List1[T] list) [0x00023] in <5d202dc8fb8f479ba5bbea3e08634e28>:0 \n at ServiceStack.Text.Common.WriteLists.WriteListString (ServiceStack.Text.Common.ITypeSerializer serializer, System.IO.TextWriter writer, System.Object list) [0x00000] in <5d202dc8fb8f479ba5bbea3e08634e28>:0 \n at ServiceStack.Text.Common.WriteLists2+<>c[T,TSerializer].b__5_0 (System.IO.TextWriter w, System.Object x) [0x00000] in <5d202dc8fb8f479ba5bbea3e08634e28>:0 \n at ServiceStack.Text.JsonSerializer.SerializeToStream (System.Object value, System.Type type, System.IO.Stream stream) [0x00012] in <5d202dc8fb8f479ba5bbea3e08634e28>:0 \n at ServiceStack.Text.JsonSerializer.SerializeToStream[T] (T value, System.IO.Stream stream) [0x00037] in <5d202dc8fb8f479ba5bbea3e08634e28>:0 \n at ServiceStack.Serialization.JsonDataContractSerializer.SerializeToStream[T] (T obj, System.IO.Stream stream) [0x00050] in :0 \n at ServiceStack.Host.ContentTypes+<>c.b__21_1 (ServiceStack.Web.IRequest r, System.Object o, System.IO.Stream s) [0x00000] in :0 \n at ServiceStack.Host.ContentTypes+<>c__DisplayClass20_0.b__0 (ServiceStack.Web.IRequest httpReq, System.Object dto, ServiceStack.Web.IResponse httpRes) [0x0000e] in :0 \n at ServiceStack.HttpResponseExtensionsInternal.WriteToResponse (ServiceStack.Web.IResponse response, System.Object result, ServiceStack.Web.ResponseSerializerDelegate defaultAction, ServiceStack.Web.IRequest request, System.Byte[] bodyPrefix, System.Byte[] bodySuffix) [0x003f0] in :0 ",“Errors”:[{“ErrorCode”:“ArgumentOutOfRangeException”,“FieldName”:“offset”,“Message”:“Specified argument was out of the range of valid values.\n”}]}}

[RequiredRole("Admin")]
        public Object Any(logRequest request)
		{

			var rootAppender = ((Hierarchy)LogManager.GetRepository())
										 .Root.Appenders.OfType<FileAppender>()
										 .FirstOrDefault();

			string filename = rootAppender != null ? rootAppender.File : string.Empty;

			String s = Util.tail(filename, request.lines, System.Text.Encoding.ASCII);
			return s.Split('\n').ToList();



		}

Please submit issues to https://github.com/ServiceStack/Issues including a stand-alone repro we can run locally to see the issue.