dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 671 forks source link

High CPU when editing C# files in large project. Mono process blows up to 170% on Macbook Air 2020 i5 #4861

Open chuckdawit opened 3 years ago

chuckdawit commented 3 years ago

Hi there

My Angular/.Net Core application (w/ VS Code) is fairly large, when I go and start editing C# files. I have an issue with the C# extension by Omnisharp. The running process 'mono' will run at 170% of my CPU. The fans kick on and in most situations don't stop. In some cases, I'll have to restart VS Code and open it back up again. In most cases the CPU% and fan will subside, but it might take 20-30 seconds of little or no code editing. If I edit specific files (ex. automapper mapping code) the CPU% goes up to 170% and doesn't stop. I can leave the room and come back 10 minutes later and it's still wizzing away at 170%. All coming from the 'mono' process (C# extension by Omnisharp) in the activity monitor.

QUESTION - Are there log files somewhere that I can capture and look at to see if there are errors in the different projects that might be causing this issue? If yes how do I capture/get them?

The solution structure is an Angular app for the client. A .Net Core app for the backend (controllers, DTO's, etc) and then I have 2 other .Net dll's that are for the models, enums, etc and one for the DB stuff like DB access and other 3rd party services.

FYI - I posted my issue on SO here - https://stackoverflow.com/questions/69775717/c-sharp-extension-for-visual-studio-code-blowing-up-my-macbook-air-2020-intel-i5

I'm using the C# extension v1.23.16

here is my >dotnet --info

.NET SDK (reflecting any global.json): Version: 5.0.100 Commit: 5044b93829

Runtime Environment: OS Name: Mac OS X OS Version: 10.15 OS Platform: Darwin RID: osx.10.15-x64 Base Path: /usr/local/share/dotnet/sdk/5.0.100/

Host (useful for support): Version: 5.0.0 Commit: cf258a14b7

.NET SDKs installed: 3.1.201 [/usr/local/share/dotnet/sdk] 3.1.301 [/usr/local/share/dotnet/sdk] 5.0.100 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download

m4rs-mt commented 3 years ago

@chuckdawit I am currently having a similar problem caused by working on a large codebase using VSCode's remote features via OmniSharp. Although the remote machine (Ubuntu 20.04) is equipped with the latest AMD processor and a huge amount of RAM, the mono process runs for about 6 hours on this codebase, consuming about 1.2 GB of RAM (only!). Disabling editor.CodeLens helped to work around this problem for me. This causes the mono process to finish in about 1:45 minutes, while still consuming about the same amount of main memory.