C# plugin hangs and cause high CPU usage while opening a big project
See original GitHub issueIssue Description
Since C# plugin 1.21.13, the C# plugin seems to hang when I open a project with more than 700 files. There is also a side effect that causes extensionHosts
to max out a single CPU core. It can be reproduced 100% of the time and I have not experience the hang to finish at any point.
**EDIT: ** My project is a Unity project
1.21.12 was the last version that was working properly for me.
Steps to Reproduce
- Open my project with C# plugin 1.21.13 or 1.21.14 installed
- Observe OmniSharp log to stop at a point
- Observe
extensionHosts
using nearly 100 unit of CPU
Expected Behavior
Project loads properly (Omnisharp prints “solution initialized”) in about a minute, Code Lens and jump to declaration works properly.
Actual Behavior
Project does not finish loading, Reference Code Lens does not appear and jump to declaration does not work.
Logs
OmniSharp log
The log contains file names to an already-live project, so I am hesitant to share. In summary, the log stops at the same line of text every time when the issue occurs.
C# log
None
Environment information
VSCode version: 1.43.0 C# Extension: 1.21.13
Mono Information
OmniSharp using global mono :6.8.0Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.0.101 Commit: bc5f8df0f5Runtime 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/3.0.101/
Host (useful for support): Version: 3.0.1 Commit: 32085cbc72
.NET Core SDKs installed: 2.1.103 [/usr/local/share/dotnet/sdk] 2.1.505 [/usr/local/share/dotnet/sdk] 3.0.101 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.0-rc2-3002702 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
cpptools | ms-vscode | 0.26.3 |
csharp | ms-dotnettools | 1.21.13 |
FlatUI | lkytal | 1.4.9 |
theme-bluloco-light | uloco | 3.0.1 |
theme-flatui | danibram | 3.1.0 |
theme-karyfoundation-themes | karyfoundation | 20.0.3 |
vscode-antlr4 | mike-lischke | 2.2.3 |
vscode-clang | mitaki28 | 0.2.3 |
vscode-icons | vscode-icons-team | 10.0.0 |
xcode-default-theme | smockle | 2.0.21 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:17 (8 by maintainers)
Top GitHub Comments
Oh goodness! Wow that’s awful, i’ll absolutely take a stab at making that code more targeted instead of diving the whole directory.
@mdowais Thank you so much for your investigation. I was looking through the changes in 1.21.13 and I think you hit on it being the node_modules folder.
@NTaylorMullen I believe this glob is chewing up the CPU for users with large node_modules. https://github.com/OmniSharp/omnisharp-vscode/pull/3593/files#diff-8c9691b11e7b8efdf4865f5653a295c5R175
We’ve had several users share .cpuprofiles which showed a large amount of time in the glob package, but I didn’t give it much weight since I know the heavy lifting is done in .NET.