Closed Klummel69 closed 9 months ago
What did you select as Data Extractor? Can you show a screenshot?
A Data Extractor is not set / available.
It is Java code. I thought until now that if no Data Extractor is used, then the expression is interpreted directly as a JSON string.
It is Java code. I thought until now that if no Data Extractor is used, then the expression is interpreted directly as a JSON string.
I got a PR that changed this for the case that the string could not be parsed.
Can you post the result of y.toString()
in the debug console or watch window?
Output of debug console:
y
"{"kind":{"graph":true},"nodes":[{"id":"1"},{"id":"2"},{"id":"3"}],"edges":[{"from":"1","to":"2"},{"from":"2","to":"3"}]}"
coder: 0
hash: 0
value: byte[120]@23
y.toString()
"{"kind":{"graph":true},"nodes":[{"id":"1"},{"id":"2"},{"id":"3"}],"edges":[{"from":"1","to":"2"},{"from":"2","to":"3"}]}"
coder: 0
hash: 0
value: byte[120]@23
The example app does not seem to work either:
Quick update, the same game in C++ works like a charm.
Could the problem be the outer quotation marks before the parenthesis? In the JSON source a quotation mark is displayed. Maybe the visualizer can't handle the fact that the Java debugger returns a " as the first character.
In the JSON source a quotation mark is displayed. Maybe the visualizer can't handle the fact that the Java debugger returns a " as the first character.
The extension tries to account for that: https://github.com/hediet/vscode-debug-visualizer/blob/9fb1e8127a39b94a362e57ee928b5ace9423259b/extension/src/VisualizationBackend/parseEvaluationResultFromGenericDebugAdapter.ts#L23-L34
However, reply.variablesReference
seems to be set, which causes the extension do use the wrong code path:
https://github.com/hediet/vscode-debug-visualizer/blob/9fb1e8127a39b94a362e57ee928b5ace9423259b/extension/src/VisualizationBackend/GenericVisualizationSupport.ts#L68
Afaik this used to work, maybe an update of the java extension changed that. Would be awesome if you could look into this by debugging it.
Instead of
y
"{"kind":{"graph":true},"nodes":[{"id":"1"},{"id":"2"},{"id":"3"}],"edges":[{"from":"1","to":"2"},{"from":"2","to":"3"}]}"
coder: 0
hash: 0
value: byte[120]@23
If would have expected the output to be just this:
y
"{"kind":{"graph":true},"nodes":[{"id":"1"},{"id":"2"},{"id":"3"}],"edges":[{"from":"1","to":"2"},{"from":"2","to":"3"}]}"
OK, I will try it over the weekend. I have never debugged an extension within a debugging.
In the meantime I have been working on debugging extensions. (First of all: I actually come from the embedded corner with C/C++. I only use Javascript for a bit of browser hacking, I haven't created Typescript yet. )
It is as you suspected.
variablesReference is != 0, so the function constructGraphFromVariablesReference() is called instead of parseEvaluationResultFromGenericDebugAdapter().
If I set the value=0 in debugging, the graph is generated correctly.
Probably, the extension should first try to decode is as JSON string and only if that fails use variablesReference
.
I'm open for a PR, but try to look at it myself this or next month.
Hello
I have used the VS Code Debug Visualizer a few times in python. It's a nice tool that helps well when debugging on nodes and edges. However, when using it with java I have a problem. It seems like the extention is not able to resolve a JSON string. I have tried different variations, the visualizer tries to resolve the Java data structure instead of the string content. If I use the string in the "Visualization Playground" it works.
Below are 2 examples. (The string is extra short, that there are no problems with a possible truncation of the text).
Expression: y or Expression: y.toString()
Debug Visualizer, Output in JSON Source:
(Sometimes the "ID" changes, the "label" text remains the same.)
Expression: y.toCharArray()
Debug Visualizer, Output in JSON Source:
What am I doing wrong, or is there a workaround?