molsonkiko / JsonToolsNppPlugin

A Notepad++ plugin providing tools for JSON like linting, querying, a tree view, and CSV conversion.
Apache License 2.0
70 stars 9 forks source link

running tests: plugin crash (SEE IF UPGRADING TO V5.6+ FIXES THIS) #17

Open igpit opened 1 year ago

igpit commented 1 year ago

select "Run Tests" from plugin menu

JsonTools.dll just crashed in runPluginCommand(size_t i : 19) Screenshot_223

Notepad++ v8.4.6 (64-bit) Build time : Sep 25 2022 - 19:51:39 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : Admin mode : OFF Local Conf mode : OFF Cloud Config : OFF OS Name : Windows 10 Pro (64-bit) OS Version : 21H2 OS Build : 19044.2006 Current ANSI codepage : 1252 Plugins : HtmlTag (1.3.5) JsonTools (3.6.1.1) MimeTools (2.8) NppConverter (4.4) NppExport (0.4) UrlPlugin (1.2) XMLTools (3.1.1.13)

molsonkiko commented 1 year ago

Hi igpit, sorry the plugin's crashing for you!

I've installed JsonTools version 3.6.1.1 on Notepad++ 8.4.6 and when I run the tests, I don't get a crash, and the tests that fail are the ones I expect to fail.

This happened when my setup was exactly the same as yours (including installed plugins) except the following differences: OS Name : Windows 10 Home (64-bit) (not Pro) OS Version : 21H1 (not 21H2) OS Build : 19043.2006 (not 19044.2006)

Since I can't replicate the bug, I'm not sure if I can help, but maybe you could share a picture of what tests passed and failed up until the crash?

chcg commented 1 year ago

Happens also to me with stacktrace:


>   JsonTools.dll!JSON_Tools.JSON_Tools.JNode.CompareTo(object other) Zeile 428 C#
    JsonTools.dll!JSON_Tools.JSON_Tools.JNode.CompareTo(object other) Zeile 410 C#
    JsonTools.dll!JSON_Tools.JSON_Tools.JNode.Equals(JSON_Tools.JSON_Tools.JNode other) Zeile 438   C#
    JsonTools.dll!JSON_Tools.Tests.JsonParserTester.TestJNodeCopy() Zeile 77    C#
    JsonTools.dll!JSON_Tools.Tests.TestRunner.RunAll() Zeile 29 C#

and exception

Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "System.FormatException" in mscorlib.dll
Ausnahme ausgelöst: "System.IndexOutOfRangeException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "System.IndexOutOfRangeException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "System.IndexOutOfRangeException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.JsonParserException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesLexerException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentOutOfRangeException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentOutOfRangeException" in mscorlib.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "System.InvalidCastException" in JsonTools.dll
Ausnahme ausgelöst: "System.InvalidCastException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "System.InvalidCastException" in JsonTools.dll
Ausnahme ausgelöst: "System.InvalidCastException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "System.InvalidCastException" in JsonTools.dll
Ausnahme ausgelöst: "System.InvalidCastException" in JsonTools.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in mscorlib.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "System.InvalidCastException" in JsonTools.dll
Ausnahme ausgelöst: "System.InvalidCastException" in JsonTools.dll
Ausnahme ausgelöst: "JSON_Tools.JSON_Tools.RemesPathException" in JsonTools.dll
Ausnahme ausgelöst: "System.IO.DirectoryNotFoundException" in mscorlib.dll
Ausnahme ausgelöst: "System.ArgumentException" in JsonTools.dll
Cannot compare null to non-null

and data

<!DOCTYPE html>
<HTML>
<head>
<title>Document</title></head>
<body>
<!--StartFragment-->

  | Name | Wert | Typ
-- | -- | -- | --
  | other | 2 | object {long}

<!--EndFragment-->
</body>
</HTML>
chcg commented 1 year ago

Notepad++ v8.4.6 (64-bit) Build time : Oct 12 2022 - 20:50:30 Path : C:\xy\npp.8.4.6.portable.x64\notepad++.exe Command Line : Admin mode : OFF Local Conf mode : ON Cloud Config : OFF OS Name : Windows 10 Home (64-bit) OS Version : 22H2 OS Build : 19045.2130 Current ANSI codepage : 1252 Plugins : HexEditor (0.9.12) JsonTools (3.7.3.1) PythonScript (3.0.14)

Testresults: json_tests.txt

molsonkiko commented 1 year ago

Hi chcg and igpit, thanks for getting back to me! I think I see what one of the problems is at least for chcg: I forgot to specify the decimal separator in my tests, so all the tests that use floating point numbers are going to fail until I manually set the decimal separator in the tests.

I'm honestly not sure whether it is even a good idea to allow the parsing of JSON that uses a decimal separator other than ., because if you allow the use of , as decimal separator, something like [15,545] is semantically ambiguous between an array containing the floating-point number 15545 and an array containing 15 and 545.

I think once I add some code throughout my plugin specifying the decimal separator wherever appropriate, that should fix most of these bugs.

It occurs to me that I could try to come up with some way to support , as decimal separator (it looks like Newtonsoft.JSON managed to), but for the above-described reason it's probably infeasible.

chcg commented 1 year ago

@molsonkiko Likely that is caused by the language\country setup used, because in german , is used as decimal separator. Maybe that could be suppressed to avoid such issues.

molsonkiko commented 1 year ago

Tried changing my system decimal settings to , for decimal separator, can confirm that this causes same tests to fail as @chcg.

igpit commented 1 year ago

sry for the late response. yes, used windows is german.

i just re-tested with JsonTools 4.1 on NPP 8.4.6. Now it fails with a new error message: jst-4 1-npp-846

Also this is the output i get in NPP:

JST41-NPP846.txt

chcg commented 1 year ago

@molsonkiko I see the same failures as reported by @igpit with release 4.1.

molsonkiko commented 1 year ago

Based on the fact that the failure happens during the Testing JSON grepper's file reading ability test suite, I'm 99.9% sure that this is because in the source code for the JSON grepper tests, I hard-coded the path to the directory where my test files were stored and never included those test files along with the DLL in the plugin.

In the future I will either make it so that the test files are included along with the DLL in my plugin, or remove those tests.

chcg commented 1 year ago

With the current version I get the first exception at:

>   JsonTools.dll!JSON_Tools.JSON_Tools.JNode.CompareTo(object other) line 436  C#
    JsonTools.dll!JSON_Tools.JSON_Tools.JNode.CompareTo(object other) line 418  C#
    JsonTools.dll!JSON_Tools.JSON_Tools.JNode.Equals(JSON_Tools.JSON_Tools.JNode other) line 446    C#
    JsonTools.dll!JSON_Tools.Tests.JsonParserTester.TestJNodeCopy() line 77 C#
    JsonTools.dll!JSON_Tools.Tests.TestRunner.RunAll() line 29  C#
    [Externer Code] 

and there are following much more. The question is if they are intented/normal or real problems.

molsonkiko commented 1 year ago

Hi @chcg , the best way to determine whether the errors are expected or not is to compare the output to "most recent errors.txt".

Unfortunately, I'm skeptical of my ability to fix any issues where something fails on your machine that doesn't fail on mine.

The tests are run from TestRunner.cs.

igpit commented 1 year ago

with the latest v4.2 when doing "Run Tests" i get a empty text file, no error popup.

then, with whatever even the smallest json test files i open, i tried "pretty print JSON" or "JSON Tree Viewer", i always get

image

molsonkiko commented 8 months ago

In the probably-related issue #16, ctidrv said

Notepad++ now shows an update to 5.6 which does resolve the issue for me.

Anybody else having this issue: try upgrading to release 5.6, or better yet, the latest release. Please let me know if upgrading to v5.6+ doesn't fix it.