vscode-csharp
vscode-csharp copied to clipboard
RZLS does not respect excluded directories & still leaks watcher processes after exit
Environment data
dotnet --info output:
.NET SDK (reflecting any global.json):
Version: 6.0.300
Commit: 8473146e7d
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.300/
Host (useful for support):
Version: 6.0.5
Commit: 70ae3df4a6
.NET SDKs installed:
6.0.300 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
VS Code version: 1.67.2
C# Extension version: v1.25.0
OmniSharp log
Starting OmniSharp server at 6/21/2022, 3:31:36 PM
Target: /home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.sln
OmniSharp server started with .NET 6.0.300
.
Path: /home/maxxen/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.omnisharp/1.39.0-net6.0/OmniSharp.dll
PID: 696709
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: .NET Core SDK 6.0.300 17.2.0 - "/usr/share/dotnet/sdk/6.0.300/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: .NET Core SDK 6.0.300 17.2.0 - "/usr/share/dotnet/sdk/6.0.300/"
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.sln'.
[warn]: OmniSharp.MSBuild.ProjectSystem
Found project that doesn't exist on disk: /home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo/Cenvigo.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Web/Cenvigo.Web.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Gateway/Cenvigo.Gateway.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Web.Analysis/Cenvigo.Web.Analysis.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/maxxen/code/work/cenvigo/Cenvigo/src'.
[info]: OmniSharp.Script.ScriptProjectSystem
Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/home/maxxen/code/work/cenvigo/Cenvigo/src' on host 685514.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Web/Cenvigo.Web.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Web/Cenvigo.Web.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Web/Cenvigo.Web.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Gateway/Cenvigo.Gateway.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Gateway/Cenvigo.Gateway.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Gateway/Cenvigo.Gateway.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Web.Analysis/Cenvigo.Web.Analysis.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Web.Analysis/Cenvigo.Web.Analysis.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Web.Analysis/Cenvigo.Web.Analysis.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: Cenvigo.Web
[info]: OmniSharp.MSBuild.ProjectManager
Found referenced project outside root directory: /home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Common/Cenvigo.Common.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Common/Cenvigo.Common.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Common/Cenvigo.Common.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: Cenvigo.Gateway
[info]: OmniSharp.MSBuild.ProjectManager
Update project: Cenvigo.Web.Analysis
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Common/Cenvigo.Common.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/home/maxxen/code/work/cenvigo/Cenvigo/src/Cenvigo.Common/Cenvigo.Common.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Update project: Cenvigo.Common
[info]: OmniSharp.OmniSharpWorkspace
Adding analyzer reference: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll
[info]: OmniSharp.OmniSharpWorkspace
Adding analyzer reference: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.NetAnalyzers.dll
[info]: OmniSharp.OmniSharpWorkspace
Adding analyzer reference: /home/maxxen/.nuget/packages/microsoft.entityframeworkcore.analyzers/6.0.5/analyzers/dotnet/cs/Microsoft.EntityFrameworkCore.Analyzers.dll
[info]: OmniSharp.OmniSharpWorkspace
Adding analyzer reference: /usr/share/dotnet/packs/Microsoft.NETCore.App.Ref/6.0.5/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll
[info]: OmniSharp.OmniSharpWorkspace
Adding analyzer reference: /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/6.0.5/analyzers/dotnet/cs/Microsoft.AspNetCore.App.Analyzers.dll
[info]: OmniSharp.OmniSharpWorkspace
Adding analyzer reference: /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/6.0.5/analyzers/dotnet/cs/Microsoft.AspNetCore.App.CodeFixes.dll
[info]: OmniSharp.OmniSharpWorkspace
Adding analyzer reference: /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/6.0.5/analyzers/dotnet/roslyn4.0/cs/Microsoft.Extensions.Logging.Generators.dll
Steps to reproduce
- Start vscode
- Open a C# project with a razor file
- Close vscode
- Repeat
Expected behavior
To not have 5 zombie rzls processes consuming thousands of inotify-watchers.
Actual behavior
rzls remains, even after vscode is closed (or even when dotnet-watch restarts after a rude edit) Using this script from stackoverflow, I can also see that rzls consumes an enormous amount of inotify instances.
INOTIFY INSTANCES
WATCHES PER
COUNT PROCESS PID USER COMMAND
------------------------------------------------------------
25580 5 685686 maxxen /home/maxxen/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.razor/rzls -lsp --trace 0
25572 5 707204 maxxen /home/maxxen/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.razor/rzls -lsp --trace 0
7896 3 707491 maxxen /home/maxxen/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.razor/rzls -lsp --trace 0
6136 2 708480 maxxen /home/maxxen/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.razor/rzls -lsp --trace 0
84 1 2603 maxxen /usr/libexec/xdg-desktop-portal-gnome
76 1 2682 maxxen /usr/libexec/xdg-desktop-portal-gtk
67 4 2102 maxxen /lib/systemd/systemd --user
28 1 23928 maxxen /usr/libexec/gvfsd-trash --spawner :1.2 /org/gtk/gvfs/exec_spaw/0
13 1 612466 maxxen /snap/firefox/1443/usr/lib/firefox/firefox
13 1 2512 maxxen update-notifier
Additional context
There are really two issues here.
- RZLS does not respect ignored directories. I have far, far less than 25580 actual source files in my project, but rzls ignores all settings in vscode to ignore non-source directories. I DO NOT want to hear that I need to increase the watch limit on my system, that is just throwing more RAM at the issue and not solving the actual problem. I even have a omnisharp.json and an editorconfig file too with exclude directories specified, but nothing works. I have an embedded SPA directory in one of my projects with a node_modules directory. If i remove it, kill all rzls processes manually and restart vscode the watcher count is much more reasonable. I have the following in my settings.json
"search.exclude": {
"**/bin": true,
"**/bin/**": true,
"**/node_modules/**": true,
"**/obj": true,
"**/obj/**": true,
"Web/Spa/ClientApp/node_modules": true,
"bin/": true,
"obj/": true,
},
"files.exclude": {
"**/bin": true,
"**/node_modules": true,
"**/obj": true,
"Web/Spa/ClientApp/node_modules": true,
"bin/": true,
"obj/": true,
},
"files.watcherExclude": {
"**/bin/*/**": true,
"**/obj/*/**": true,
"**/node_modules/*/**": true,
"**/bin/**": true,
"**/obj/**": true,
"**/node_modules/**": true,
"Web/Spa/ClientApp/node_modules": true,
"bin/": true,
"obj/": true,
},
Omnisharp.json:
{
"fileOptions": {
"systemExcludeSearchPatterns": [
"**/node_modules/**/*",
"**/bin/**/*",
"**/obj/**/*"
],
"excludeSearchPatterns": []
}
}
- RZLS does not properly shutdown. This seems to be a long standing issue, see #2851, #5178
This MAJOR problem has been in existence for years. It's something I struggle with multiple times every day.
Related:
- https://github.com/OmniSharp/omnisharp-vscode/issues/5178
- https://github.com/OmniSharp/omnisharp-vscode/issues/2851
- https://github.com/OmniSharp/omnisharp-vscode/issues/5284
- https://github.com/OmniSharp/omnisharp-vscode/issues/3284
- https://github.com/OmniSharp/omnisharp-vscode/issues/3368
- https://github.com/OmniSharp/omnisharp-vscode/issues/4350
Possible diagnoses:
- https://github.com/Azure/bicep/issues/8171#issuecomment-1232322963
- https://github.com/OmniSharp/omnisharp-vscode/issues/4350#issuecomment-1163536551
The vscode team has had trouble reproducing this issue; I hope aggregating these will help them repro and find the root cause.
Hi all! C# extension v1.25.4 was released earlier today which should address this problem. Please let us know if you continue to run into issues. Thanks, and happy coding!
@dibarbet Could you help close out this issue? (I don't have permissions.)