Open meshake opened 4 years ago
Thanks for reporting, I can't seem to reproduce it currently. Might be a Windows specific issue or maybe JDK one? What Java version are you using?
@tgodzik
java -version openjdk version "1.8.0_212" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b04) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b04, mixed mode)
Thanks! @alekseiAlefirov managed to confirm the issue, this seems to be happening on JDK 8 and looks fine on JDK 11
I finally managed to investigate this a bit and it seems that because we are currently using https://github.com/microsoft/java-debug it breaks on each thrown exception and the current the behavior is expected. There is unfotunately no way to specify an exact filter using DAP. We would most likely need to solve the issue in Metals, my guess is that we would need to:
I am not sure if that is a perfect solution, I think it would be much better if it was solved on the client side.
Java extension did something similar here: https://github.com/microsoft/vscode-java-debug/pull/829
As this is a bit more involved than initially though I will move it out to feature requests.
This issue becomes one major source of frustration when working with heavy weight frameworks such as flink, kafka. While these frameworks handle exceptions we still have to sift through them to get to our own code. Only recourse is to liberally add breakpoints and hope to catch them soon. I'm not sure if VSCode's logpoints work as then I would simply add those liberally and examine all outputs in one go
Filtering debug steps is something I have investigated in https://github.com/scalacenter/scala-debug-adapter/issues/122. I think we can solve it in the debug server by adding a notion of ClassFilters
into java-debug as proposed in https://github.com/scalacenter/scala-debug-adapter/issues/122 as "Solution 1". My plan is to start working on it in April.
The debugger seems to work fine if I uncheck "Caught Exceptions" in the "Breakpoints" pane. However, if I enable it then the debugger breaks in URLClassLoader java class method findClass line 382:
To Reproduce Steps to reproduce the behavior:
object Hello { def main(args: Array[String]): Unit = { val a = "Hello World!" val b = 42 println(a) } }