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
Breakpoints not working in debugging a vscode extension #42858
Comments
Attaching a .zip with the 'toy project'. I just zipped up the directory and then deleted node_modules to save some space. Need to run npm install to get them back. |
Hi, First, thanks building an extension! In your
this means that we'll first activate your extension if this event is triggered, so if you set a breakpoint inside If you had the following
your extension would get activated when VS Code starts up, but we don't recommend this for performance reasons. An extension should only get activated when it's used. |
I just pulled down your project, updated the launch.json to
and is able to break when your command is run: |
@kdvolder I've installed your my-new-extension.zip on ubuntu 16.04, ran So your problem does not seem to be easily reproducible.
|
My Ubuntu version is Ubuntu 14.04 LTS. @weinand You may be on to something that this is timing issue of some kind. So it could be a race condition which would explain why its not easy to reproduce. I put a breakpoint in line 21. The breakpoint did not get hit the first time I invoked the 'Hello World' command. I.e. execution passed right through it. However the breakpoint did get triggered the second time. Also the third time etc. Just not the first time. It is worth mentioning that even the first time it was not 'very early in the startup process'. Because the plugin extension does not get loaded until the command is actually invoked. So the log message only gets printed when the command is invoked the first time. I.e. when I press 'CTRL-P' and execute the command. Typically this some time after vscode debug instance's startup. It still seems some timing issue are at hand here though. Do breakpoints get registered dynamically only when a corresponding source file is loaded? If so, maybe the response to activate the breakpoint to this 'load event' is too slow? @auchenberg Yes, I understand that you need to invoke the 'Hello World' command to activate the extension. And I would expect that is when the breakpoint should get hit, but it doesn't. At least not for me. |
Also worth mentioning again the 'stopOnEntry' flag in launch.json seems to have no effect (i.e. whether I set it to true or false, the extension host doesn't get stopped). I'm pretty sure this used to work in the past. Not sure this is the same, related or different problem. I can raise a separate bug for that if you wish. |
More info that may help... Following up on @auchenberg suggestion. I changed my 'launch.json' according to his example. Basically... I removed the 'sourceMaps: true' piece and 'stopOnEntry: ...' piece. With this change the breakpoint on line 12 is still skipped, but the breakpoint on line 21is hit even the first time. It also doesn't make much sense to me that I should remove 'sourceMaps: true'. These are typescript compiled to .js with sourcemap files generated on the side. So don't we need the debugger to make use of these sourcemaps? |
Yes, as mentioned in original report, though it may be hard to see amongst all the other auto-generated infos. |
More info. I noticed that @weinand mentioned using VS Code 1.19.2. I think I'm using 1.19.3 (according to auto generated bits of the report). Decided to give code-insiders a try as well. My breakpoints in the sample project work perfectly in |
@kdvolder the default for 'sourceMaps' is true anyway. So removing that attribute from a launch configuration cannot have any effect. Yes, trying Insider is always a good strategy as we are fixing issues all day ;-) |
@weinand I assume you closed this because it works in Insiders? Note however that |
@kdvolder yes, closed because it works in Insiders (and I assume in the upcoming January stable release as well). Yes, please file a new issue about the |
Steps to Reproduce:
extension.ts
=> Observe that...
Note: I have also tried to make set
In launch.json, but also in this case the debugger doesn't seem to work at all. I.e. the process just runs and doesn't stop anywhere, not on entry and not on any breakpoint I have put.
I first observed this in one of my own extension, trying to debug it. Then I verified it with brand-new generated 'sample' from the yo-code generator.
I can attach the generated project (didn't make any changes to it though, just generate, put breakpoint and run). Or let me know if there's any other information that might be useful and I'll do my best to provide it.
Reproduces without extensions: Yes
The text was updated successfully, but these errors were encountered: