New to Telerik Reporting? Download free 30-day trial

System.ArgumentException The JSON value of length n is too large and not supported

Environment

Product Progress® Telerik® Reporting
Project Type ASP.NET Core
Report Viewers HTML5-based Report Viewers

Description

Rendering a report with a lot of data, hence a big number of pages, would result in displaying the "System.ArgumentException: The JSON value of length n is too large and not supported" error message inside the report viewer at some point.

Error Message

CSharp.Net6.Html5IntegrationDemo Error: 0 : An error occurred while rendering the report in separate thread: System.ArgumentException: The JSON value of length 174438958 is too large and not supported.
   at System.Text.Json.ThrowHelper.ThrowArgumentException_ValueTooLarge(Int32 tokenLength)
   at System.Text.Json.Serialization.Converters.ByteArrayConverter.Write(Utf8JsonWriter writer, Byte[] value, JsonSerializerOptions options)
   at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.JsonSerializer.WriteUsingSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo)
   at System.Text.Json.JsonSerializer.WriteBytesUsingSerializer[TValue](TValue& value, JsonTypeInfo jsonTypeInfo)
   at Telerik.Reporting.Services.Engine.DocumentResources.AddResource(RenderingResource resource)
   at Telerik.Reporting.Services.Engine.Document.AddClientSearchItemsResource(IList searchItems)
   at Telerik.Reporting.Services.Engine.Document.FinishRendering(ReportRendererResult result)
   at Telerik.Reporting.Services.Engine.Rendering.SaveResult(ReportRendererResult result)
   at Telerik.Reporting.Services.Engine.CompressPagesRendering.SaveResult(ReportRendererResult result)
   at Telerik.Reporting.Services.Engine.Rendering.ThreadFunc(Object o)

Cause\Possible Cause(s)

This problem occurs when the Telerik Reporting tries to generate the search metadata that the report viewer uses for its search functionality.

Suggested Workarounds

By default, the search metadata is generated automatically but it can also be set to be on-demand which would resolve the issue for the cases when the search is not used.

$(function () {
  $("#reportViewer1").telerik_ReportViewer({
    serviceUrl: "api/reports/",
    reportSource: {
        report: "Telerik.Reporting.Examples.CSharp.Invoice, CSharp.ReportLibrary"
    },
    searchMetadataOnDemand: true // set this property to true to generate the search metadata only when needed
});

See Also

In this article