Open
Description
Cannot load source code during Java debugging in a certain scenario.
Environment
- Operating System: OSX
- JDK version: 1.8.0_201
- Visual Studio Code version: 1.30.2
- Java extension version:0.6.0
- Java Debugger extension version:0.17.0
Steps To Reproduce
- Clone and build the google closure compiler at https://github.com/google/closure-compiler
- Set a breakpoint at src/com/google/javascript/jscomp/PeepholeCollectPropertyAssignments.java
- Build the project using maven (instruction included at the front page of the repo)
- Debug
Current Result
The breakpoint hits, but then loading sour code fails with this error.
Could not load source '': SourceRequest: property 'sourceReference' is missing, null, or empty.
Expected Result
Loading source code should work.
Additional Information
This is a clone of issue 550 in the vscode-java-debug repo. I believe the root cause of the bug is in this repo, so I cloned the issue over.
I believe I have some idea why the scenario is failing:
- When the debuggee stops - VSCode calls getCallStackImpl(), when it is done, the sources are retrieved and stored in a cache. The source reference of the source object retrieved by the getCallStackImpl() is probably produced by convertDebuggerSourceToClient which hardcoded 0 (three times in different cases) for the sourceReference parameter.
- Then VSCode is trying to load the source, it invokes the createOrUpdateContentModel function to do so. It made some attempt to consult the modelService. In my scenario, it fails, and it use the debug session to load sources using the previously generated Uri and source reference. I believe it will eventually end up at here, obviously it will fail because source reference is 0.
- I think there might be an easy fix. We can create a source reference when we produce a stack trace, and then we should be able to resolve by the time we are done.
I submitted a pull request for my idea in 3, I haven't been able to test this yet.
Metadata
Metadata
Assignees
Labels
No labels