DevToys-app / DevToys

A Swiss Army knife for developers.
https://devtoys.app/
MIT License
26.94k stars 1.45k forks source link

【JSON formatter】Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray #620

Closed lic0914 closed 2 years ago

lic0914 commented 2 years ago

Description

When I input the string "[]" in JSON formatter, I had the follow exception !

Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.

Steps To Reproduce

No response

Expected behavior

Expected the beautiful json format

DevToys Version

Version 1.0.9.0 | X64 | RELEASE | 8bcfa60 | 8bcfa60

Relevant Assets/Logs

# - [08/01/2022 16:25:54]
Feature name: SmartDetection - Check if tool is recommended
Custom message: Tool : Xml Validator
Exception message: Data at the root level is invalid. Line 1, position 1.
Exception stack trace:
   at System.Xml.XmlTextReaderImpl.Throw(Exception) + 0x6c
   at System.Xml.XmlTextReaderImpl.Throw(String, String) + 0x56
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() + 0x1a5
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent() + 0x22d
   at System.Xml.XmlTextReaderImpl.Read() + 0x355
   at System.Xml.XmlTextReader.Read() + 0xf
   at System.Xml.Schema.Parser.StartParsing(XmlReader, String) + 0xb7
   at System.Xml.Schema.Parser.Parse(XmlReader, String) + 0x10
   at System.Xml.Schema.XmlSchema.Read(XmlReader, ValidationEventHandler) + 0x86
   at DevToys.ViewModels.Tools.XmlValidator.XmlValidatorToolProvider.ValidateXsdData(String) + 0x122
   at DevToys.ViewModels.Tools.XmlValidator.XmlValidatorToolProvider.CanBeTreatedByTool(String) + 0x18
   at DevToys.Api.Tools.ToolProviderViewItem.<UpdateIsRecommendedAsync>d__40.MoveNext() + 0xc0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult() + 0xb
   at DevToys.ViewModels.MainPageViewModel.<>c__DisplayClass88_1.<<UpdateRecommendedToolsAsync>b__2>d.MoveNext() + 0x107
lic0914 commented 2 years ago

image

nickpainter commented 2 years ago

I am encountering this same issue on the latest version of devtoys. This bug did not exist in 1.0.8.0.