runtime: System.Text.Json.JsonSerializer.Deserialize crashes when parsing large string using Blazor

This issue has been moved from a ticket on Developer Community.


[severity:Other] [regression] [worked-in:somewhere before 16.7.1] Using Blazor/Wasm (3.2.0) and trying to parse a large json-string (135123600 chars) loaded from a file on my local windows machine, System.Text.Json.JsonSerializer.Deserialize crashes with the following internal exception (or similar, varies somewhat from run to run):

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: ‘r’ is an invalid start of a property name. Expected a ‘"’. Path: $[4888].ID | LineNumber: 63547 | BytePositionInLine: 0. System.Text.Json.JsonException: ‘r’ is an invalid start of a property name. Expected a ‘"’. Path: $[4888].ID | LineNumber: 63547 | BytePositionInLine: 0. —> System.Text.Json.JsonReaderException: ‘r’ is an invalid start of a property name. Expected a ‘"’. LineNumber: 63547 | BytePositionInLine: 0. at System.Text.Json.ThrowHelper.ThrowJsonReaderException (System.Text.Json.Utf8JsonReader& json, System.Text.Json.ExceptionResource resource, System.Byte nextByte, System.ReadOnlySpan`1[T] bytes) <0x8575f78 + 0x00020> in <filename unknown>:0 at System.Text.Json.Utf8JsonReader.ConsumeNextToken (System.Byte marker) <0x285e1d8 + 0x00264> in <filename unknown>:0 at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback (System.Byte marker) <0x285dfa8 + 0x0003a> in <filename unknown>:0 at System.Text.Json.Utf8JsonReader.ReadSingleSegment () <0x2851dd8 + 0x001de> in <filename unknown>:0 at System.Text.Json.Utf8JsonReader.Read () <0x2851960 + 0x0000e> in <filename unknown>:0 at System.Text.Json.JsonSerializer.ReadCore (System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonReader& reader, System.Text.Json.ReadStack& readStack) <0x28799e0 + 0x00060> in <filename unknown>:0

Line number of the file and position varies where it fails /(and therefore what is expected (number, string or property name).

The string contains a list of objects like:

[ { “ID”: 0, “DateTime”: “2018-08-09T08:57:34”, “SiteWrapper”: null, “SiteWrapperID”: 1, “Lev”: [ 40.3, 0, 78.9, 65.6, 55.5 ] }, { “ID”: 0, “DateTime”: “2018-08-09T08:57:35”, “SiteWrapper”: null, “SiteWrapperID”: 1, “Lev”: [ 70.4, 72.1, 71.2, 0, 64.5 ] },

and so on. (all in all 604621 instances). (so far tested on Chrome 84.0.4147.135 and Microsoft Edge 44.18362.449.0)


Original Comments

Feedback Bot on 8/27/2020, 01:09 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (16 by maintainers)

Most upvoted comments

@layomia thanks for the tip about the async version! I can just confirm that it works.