dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.

Home Page:https://docs.microsoft.com/visualstudio/msbuild/msbuild

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Multiple instances of .NET host, hogging more than 95% memory and CPU

arkalyanms opened this issue · comments

From vscode-dotnettools created by dibarbet: microsoft/vscode-dotnettools#518

Describe the Issue

Copied from dotnet/vscode-csharp#6344

Issue Description

Multiple instances of .NET process. We have 42 csproj in our microservices-based solution. And every time I build the solution, the multiple .NET process gets spawned hogging up 95% of the CPU. And after building the instances do not get disposed of or close, they just sit there on RAM without any reason hogging up RAM as well.
I would suggest please find a better way to reuse the instances of the .NET host to build the solution and to keep some data between the builds so that we can stop building unchanged projects just like Visual Studio. Because spinning up the process every time does not look viable solution in the long run. Below are the screenshots. If you see closes the CMD instances are still there, I guess we can shut them once the build is complete just like .NET process.

When building.
image
After the build is done.
image

Steps to Reproduce

Expected Behavior

.NET instances should be reused to build projects and should get closed once done.

Actual Behavior

Multiple instances are spawned and does not get disposed.

Logs

C# log

Post the output from Output-->C# here

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires `dotnet.server.trace` to be set to `Trace`

Environment information

VSCode version: 1.82.0
C# Extension: 2.1.2
Using OmniSharp: false

Dotnet Information Error running dotnet --info: Error: Command failed: C:\Program Files\dotnet\dotnet.exe --info 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Visual Studio Code Extensions
Extension Author Version Folder Name
csdevkit ms-dotnettools 0.4.10 ms-dotnettools.csdevkit-0.4.10-win32-x64
csharp ms-dotnettools 2.1.2 ms-dotnettools.csharp-2.1.2-win32-x64
darker-dark XavierNaves 1.0.0 xaviernaves.darker-dark-1.0.0
EditorConfig EditorConfig 0.16.4 editorconfig.editorconfig-0.16.4
errorlens usernamehw 3.13.0 usernamehw.errorlens-3.13.0
gitlens eamodio 14.3.0 eamodio.gitlens-14.3.0
powershell ms-vscode 2023.9.1 ms-vscode.powershell-2023.9.1
sonarlint-vscode SonarSource 3.21.0 sonarsource.sonarlint-vscode-3.21.0-win32-x64
vim vscodevim 1.26.0 vscodevim.vim-1.26.0
vscode-autohotkey2-lsp thqby 2.1.5 thqby.vscode-autohotkey2-lsp-2.1.5
vscode-conventional-commits vivaxy 1.25.0 vivaxy.vscode-conventional-commits-1.25.0
vscode-dotnet-runtime ms-dotnettools 1.7.2 ms-dotnettools.vscode-dotnet-runtime-1.7.2
vscode-eslint dbaeumer 2.4.2 dbaeumer.vscode-eslint-2.4.2
vscode-jest Orta 5.2.3 orta.vscode-jest-5.2.3
vscodeintellicode-csharp ms-dotnettools 0.1.26 ms-dotnettools.vscodeintellicode-csharp-0.1.26-win32-x64

Steps To Reproduce

No response

Expected Behavior

No response

Environment Information

No response

@ladipro this is in relation to email convo to tweak process lifetimes for the MSBuild worker processes.