microsoft / devicescript

TypeScript for Tiny IoT Devices (ESP32, RP2040, ...)
https://microsoft.github.io/devicescript/
MIT License
3.27k stars 118 forks source link

debugger stop/start race condition #290

Closed pelikhan closed 1 year ago

pelikhan commented 1 year ago

image

VSCode: launch {"name":"DeviceScript","type":"devicescript","request":"launch","program":"D:\\test\\demo/src/main.ts","deviceId":"accc93ab97011c30","stopOnEntry":false,"__configurationTarget":6,"__sessionId":"07a00ae7-57ed-4d07-90c5-a868ff11d00a"}
Error: no debugger on the bus; timeout=2000ms
    at DsDapSession2.createClient (D:\test\demo\node_modules\@devicescript\cli\built\devicescript-cli.cjs:22888:15)
    at async DsDapSession2.startClient (D:\test\demo\node_modules\@devicescript\cli\built\devicescript-cli.cjs:22892:23)
    at async DsDapSession2.startDebugger (D:\test\demo\node_modules\@devicescript\cli\built\devicescript-cli.cjs:22994:9)
    at async DsDapSession2.asyncReq (D:\test\demo\node_modules\@devicescript\cli\built\devicescript-cli.cjs:23320:11)
SRV: ERR launch
pelikhan commented 1 year ago

when pressing stop, the simulator gets killed but the bus keeps it "alive" for a couple second. WHile at the same time the debugger finds the future-dead simulator instance and decides to use it. Half-way through, the debugger can't find the device anymore.