We're using the news app in 2sxc and it works fine, we can add and edit articles. However when we use the manage articles link ("contentitems?contentType=News"). It seems there is some corrupt data in (at least) 1 of the articles. When we check with F12 we get the following errror:
{
"Message": "An error has occurred.",
"ExceptionMessage": "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": null,
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "Unable to translate Unicode character \\uD835 at index 121 to specified code page.",
"ExceptionType": "System.Text.EncoderFallbackException",
"StackTrace": " at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)\r\n at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)\r\n at System.Text.UTF8Encoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount, EncoderNLS baseEncoder)\r\n at System.Text.EncoderNLS.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount, Boolean flush)\r\n at System.Text.EncoderNLS.GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex, Boolean flush)\r\n at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)\r\n at System.IO.StreamWriter.Write(Char value)\r\n at Newtonsoft.Json.JsonTextWriter.WriteEnd(JsonToken token)\r\n at Newtonsoft.Json.JsonWriter.AutoCompleteClose(JsonContainerType type)\r\n at Newtonsoft.Json.JsonWriter.WriteEndObject()\r\n at Newtonsoft.Json.JsonWriter.WriteEnd(JsonContainerType type)\r\n at Newtonsoft.Json.JsonWriter.WriteEnd()\r\n at Newtonsoft.Json.JsonWriter.AutoCompleteAll()\r\n at Newtonsoft.Json.JsonTextWriter.Close()\r\n at Newtonsoft.Json.JsonWriter.Dispose(Boolean disposing)\r\n at Newtonsoft.Json.JsonWriter.System.IDisposable.Dispose()\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__24.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"
}
}
Is there anything we can do about that? Is there a known solutions for this?
This is not a common issue.
To me it sounds like
System.Text.Jsonhas a problem serializing, but it could be caused by something before that generating an Exception which could be the primary issue.I suggest you check the 2sxc server insights to see if you have any problem on that specific API call - see https://go.2sxc.org/insights