-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger is using old cached test file #302
Comments
@testforstephen, we need take a look at the source mapping container in the attach scenario. |
@IzakMarais The java debug extension doesn't cache your java files to some temp directory. Not sure where it comes from. Can you share why there are cached versions in your environment? |
I have no idea, maybe it's something that maven surefire does? But how would the debugger know to open that file? What might I do to debug it further? |
The debugger will ask the language server to get the source mapping (file <-> class) for current hitting location. And the source mapping relationship is built up by java language server when your workspace is loaded to VS Code. Could you remove the cached directory and try again? |
I've tried searching the workspace for a file where this source mapping might be cached, but have not managed to find anything. |
The cached source mapping is placed at the directory |
Great. I can confirm that after:
it works correctly and attaches to the correct version of the file where the breakpoint is set. So the question becomes why is this manual intervention necessary? |
It looks like a bug at the underlying language server service. It caches external java files (don't belong to current vscode workspace folder) to current workspace mistakenly. If you could provide the reproduce steps, that would be helpful for us to investigate. |
After switching to a new computer, and working in a different repository for a couple of months, this behaviour appeared today. So it seems very intermittent and difficult to reproduce. |
I'm encountering the same issue is there anyway to workaround? where's the cache location for ubuntu? |
see microsoft/vscode#3884 for workspaceStorage in ubuntu |
I am having the same problem in Visual Studio. It has happened a few times today. I am debugging code that I edited, but it keeps running the same code over and over, no matter what change. I even commented out a bunch of code, I set break points, and it just runs right through with the old code. |
Since I am connecting to a database to extract data to some variables in the program, and this seems to be where the hangup is occurring, I intentionally changed the password to throw an error connecting to the database, and then when I changed the password back it works again after that. |
And it just happened again, and this time I changed the password to connect to the database to an incorrect password, but it is still running the code before the same as before the changes were made. |
could you invoke "Java: Clean the Java language server workspace" command or "Java: Force Java Compilation" to see whether fix this problem? |
Same issue... Prettier did some formatting (1 line > 4 lines) and all my previously set breakpoints are now 3 lines early on that file. |
@testforstephen any updates for this? |
any update on this, I am facing the same issue and I am running on a mac 2020, with BigSur. |
Any update on this? |
This worked for me. Adding this task in {
"version": "2.0.0",
"tasks": [
{
"label": "clear-editor-history",
"command": "${command:workbench.action.clearEditorHistory}"
}
]
} And using the task in launch configuration ( {
"version": "0.2.0",
"configurations": [
{
...
"preLaunchTask": "clear-editor-history"
...
}
]
} |
Well this is awkward... I came here specifically to report that |
this works for me。 it's weird, the result is different with or without breakpoints |
I want to debug /home/ubuntu/source/test/QuickStart.java but the debugger try to debug files in /home/ubuntu/.vscode-server/data/User/workspaceStorage/052d2585193dcc6cf9345bedcec13d13 |
I want to debug QuickStart.java, why does the extension debug 9rWa.java? the extension is unusable!! |
Looks like the solution is what colleagues have commented on earlier. We need to delete the files cached by vscode in the workspacestorage and tmp folders, this fixes it for a while, but the problem eventually returns. Has a definitive solution been released to resolve this issue? |
When I set a breakpoint and use the debugger, it opens an old cached version of the source file
Environment
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
Steps To Reproduce
mvn -Dmaven.surefire.debug test
to run the test. Stops atListening for transport dt_socket at address: 5005
Cick on top call stack item in vscode debug panel shows some older cached version of the file (note file path in AppData/Local/Temp):
This used to work fine a couple of months ago.
The text was updated successfully, but these errors were encountered: