Skip to content
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

VS Code terminates if when clicking Debug -> Start without Debugging for extension tests #81090

Closed
DanTup opened this issue Sep 18, 2019 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@DanTup
Copy link
Contributor

DanTup commented Sep 18, 2019

  • Run yo code to generate the sample TypeScript extension
  • Open in VS Code
  • Click Debug -> Start Without Debugging
  • VS Code completely vanishes

It used to output a message about not being able to run tests from the command line while an instance of VS Code is open (a slightly misleading message, and a frustrating limitation, but at least it was clear what happened). Now, VS Code just disappears as if it crashed. This seems like rather undesirable behaviour.

I often run things without the debugger when I know I won't be debugging (for various reasons) so out of habit I often hit Ctrl+F5. Having to restart VS Code seems like a high penalty for that mistake :-)

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Oct 16, 2019
@weinand weinand assigned isidorn and unassigned weinand Oct 16, 2019
@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Oct 16, 2019
@isidorn
Copy link
Contributor

isidorn commented Oct 16, 2019

@DanTup nice catch, thanks for filling this. I can reproduce.
I can also reproduce it with the current stable version and the previous stable version. So it seems like we always had this, just people did not hit it. Thus this is not a candidate.
Investigating

@isidorn isidorn added this to the October 2019 milestone Oct 16, 2019
@DanTup
Copy link
Contributor Author

DanTup commented Oct 16, 2019

I can also reproduce it with the current stable version and the previous stable version. So it seems like we always had this, just people did not hit it.

It hasn't always been this way - it used to print a message in the console like "running tests from the command line is only possible when no instance of VS Code is open" (I always found the message amusing, since I wasn't running from the console - I guess it was triggered by not having the debugger attached - though honestly I don't understand why that limitation exists).

I agree it's not a priority though, the impact is low (though it is a little frustrating for those of us when we do hit it :-))

@isidorn
Copy link
Contributor

isidorn commented Oct 22, 2019

I can repro this all the time. However I am pretty clueless who is closing the window.
What I found is that it is not the debug service closing the window here

Trying to find out who calls electronService.closeWindow. Also produced no effect.

@weinand @bpasero might you have ideas who might close the first window when debugging EH tests with NoDebug flag?

@bpasero
Copy link
Member

bpasero commented Oct 22, 2019

I cannot reproduce, a new window opens with the extension being debugged. I tried insiders and out of sources, 😩

@bpasero
Copy link
Member

bpasero commented Oct 22, 2019

Oh this is running tests, yeah I see it...

@bpasero
Copy link
Member

bpasero commented Oct 22, 2019

@isidorn seems to be this code:

If you run code with --verbose you see more output:

...
CommandService#executeCommand setContext
  1 passing (10ms)
[main 2019-10-22T15:37:12.011Z] IPC#vscode:exit null
[main 2019-10-22T15:37:12.012Z] Lifecycle#kill()
[main 2019-10-22T15:37:12.013Z] Lifecycle#window.on('closed') - window ID 1
[main 2019-10-22T15:37:12.017Z] Lifecycle#window.on('closed') - window ID 3

@weinand
Copy link
Contributor

weinand commented Oct 23, 2019

The problem is the definition of the environment flag isExtensionDevTestFromCli:

let isExtensionDevTestFromCli = isExtensionDevHost && !!environmentService.extensionTestsLocationURI && !environmentService.debugExtensionHost.break;

This flag should not become true when launching an extension (or its tests) from the debugger (even if "Start without Debugging" is used).

But the condition environmentService.debugExtensionHost.break is not correct because when "Start without Debugging" is used, the value of "break" is false, but the extension is still launched from the debugger.

The correct condition is environmentService.debugExtensionHost.debugId

@bpasero
Copy link
Member

bpasero commented Oct 23, 2019

Thanks!

@connor4312 connor4312 added the verified Verification succeeded label Oct 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants