Closed BABAYEGAR closed 1 year ago
OS info: Amazon Linux 2 | x86_64, arm64
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis See info in area-owners.md if you want to be subscribed.
Author: | BABAYEGAR |
---|---|
Assignees: | - |
Labels: | `area-System.Text.Json`, `untriaged` |
Milestone: | - |
Can you share the part of the json that is causing this? Ideally reduce your json file down to just the minimum necessary to still make it fail
This is by-design, but we have an issue tracking potentially tolerating invalid data:
Hi @danmoseley Honestly its a very very large JSON for about 3MB worth of data. Its super hard to know where the error is from. The json contains excel spreadsheet data and structure but when i paste the json in a json formatter it says the json structure is valid and the error never appears on a windows machine too
No problem, it looks like the team knows the issue, per above.
Description
This occurs when i try to parse very large complex json, using the JsonObject.Parse() from a file stream.
Configuration
Regression?
Not sure it did, a new feature i am working on uses large json so that's where i discovered the error
Other information
Exception: System.Text.Json.JsonException: '0x00' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0. ---> System.Text.Json.JsonReaderException: '0x00' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0. at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, JsonReaderException ex) at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack) at System.Text.Json.JsonSerializer.ReadCore(Type returnType, JsonSerializerOptions options, Utf8JsonReader& reader) at System.Text.Json.JsonSerializer.Deserialize(String json, Type returnType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options) at PowerLauncher.SettingsWatcher.OverloadSettings() at PowerLauncher.SettingsWatcher..ctor(Settings settings) at PowerLauncher.App.<>c__DisplayClass16_0.b1() at Wox.Infrastructure.Stopwatch.Normal(String message, Action action) at PowerLauncher.App.OnStartup(Object sender, StartupEventArgs e) at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Seems like Newtonsoft handles such scenario correctly. But i prefer system.text.json as it is more efficient.