Closed chesteryang closed 6 years ago
@chesteryang The debugger doesn't know anything about these node.js processes, so it will not kill them. This is true for both Visual Studio and VS Code.
Is your code spawning them?
@gregg-miskelly
Yes, the project was created using dotnet new reactredux -n my-app.
in Startup.cs,
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseReactDevelopmentServer(npmScript: "start");
}
});
in package.json "scripts": { "start": "rimraf ./build && react-scripts start",
This script will create those nodejs processes. But in Visual Studio 2017, default to IIS express, stop debugging will kill all of them.
and in command line, if I use dotnet run to start app, I can use ctrl+c to shut down dotnet process and all its child processes.
So you can get the command line behavior if you set "console": "externalTerminal"
. 'integratedTerminal' would probably also work.
For a better fix: if I am tracking things down correctly, it sounds like you are running into a bug in the ASP.NET JavaScriptServices. There is an issue that sounds just like you describe here: https://github.com/aspnet/JavaScriptServices/issues/270
Looking at what I think is their code to spawn node, they seem to be providing their parent pid for this purpose.
Should have also said: so I would probably suggest opening a new issue in that repo if you are running a build that should have that fix.
@gregg-miskelly Okay, thanks.
Environment data
dotnet --info
output: dotnet-info.txtVS Code version:1.24.1 C# Extension version:1.15.2
The issue was filed to vscode first: https://github.com/Microsoft/vscode/issues/51933
Steps to reproduce
In process explorer this was found:
In debugging, process (id=13360) is a child process under dotnet.exe process (id=11188)
Out of debugging, the process (id=13360) didn't get killed and its parent is gone.
Expected behavior
It should work like Visual Studio 2017's debugging, while stopping debugging, all nodejs processes should be killed.
Actual behavior
nodjs processes are hanging in memory.