Debugger gives no info in VS Code with HashLink

Update: issue found & solved.

I’m trying to get started with Haxe using VS Code on Windows. I want to run my application with Hashlink, but when configuring the VS Code debugger the panels are blank. As in, no stack, no variables, nothing.

This is what I see when the application errors: http://prntscr.com/m1y3iz

My hxml:

-cp src
-main Main
-hl build.hl

Launch.json:

{
  "configurations": [{
    "name": "HashLink",
    "request": "launch",
    "type": "hl",
    "hxml": "build.hxml",
    "cwd": "${workspaceRoot}",
    "internalConsoleOptions": "openOnSessionStart",
    "preLaunchTask": "Build"
  }]
}

Building + running the application works, it shows when it’s stopped due to an error, and killing the program via the debugger controls works too. But there’s no information whatsoever in the IDE. No stack traces on error, not even an error message. Even when I’m manually throwing an error to test it, it doesn’t show a thing.

Does anyone know what I’m missing to get this working in VS Code?

  • Haxe Compiler 4.0.0-preview.5+7eb789f54
  • HL/JIT 1.8.0
  • Windows 10

Hello,

I believe you have the same problem than me.

Just to be sure : your OS is Linux ?

I’ve made a mini-project available on github for checking :

I’m actually on Windows (updated my original post). I found your issue when searching for a solution, it was the only think that seemed somewhat similar to my situation so it may be caused by the same bug, but it’s about linux and you get “failed to connect to debug port” whereas I get that it’s connected but then no debugger information whatsoever.

Hopefully someone will come along soon with a solution to both our problems :slight_smile:

Update: With the help of a maintainer of the VS Code extension, I was able to find the issue and fix it. It had to do with the extension returning null where it should have returned undefined. The pull request has been merged so this particular issue should be resolved as soon as a new release is published.

@jseb You’ll probably want to check if this also fixes your problem. If an update isn’t published soon, you can quickly patch your installed extension in [wherever your .vscode directory is on linux]/extensions/haxefoundation.haxe-hl-0.5.1/hladapter.js. Just search for null ? null (there should be only one occurrence) and change it to null ? undefined.

Hello, thank you for posting your solution. I’m glad that it worked for you, at least :wink:

I’ve made the suggested changes, but for me it doesn’t change. But just to be sure, can you tell me those step are correct for debugging ?

  1. launch vscode

  2. open project and put a breakpoint in the code.

  3. C-S-d (invoke debugger)

  4. at the top-left, choose HashLink launch and then press F5
    At this step, my cpu goes 100% and i have this in my process:
    28906 ? Rl 0:15 hl --debug-wait --debug 6112 test.hl
    But nothing happens in vscode. (no informations in debug subwindows)

  5. on the same menu, choose HashLink attach and then F5 again.
    In the callstack of the debug subwindows, i see now:

     HashLink (launch)  RUNNING
     HashLink (attach)  RUNNING

But that’s all. My CPU is still hogged to 100%, and nothing more happens.
I have to kill myself the hl instance in memory.

That means your issue is unfortunately not related to mine.

I do recommend checking out the Haxe discord, they were very helpful when I asked my question there.

1 Like