dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 667 forks source link

"Command line too long" error in C# 1.20.0 because of "files.exclude" setting #3127

Open stefanhamburger opened 5 years ago

stefanhamburger commented 5 years ago

With the new feature to ignore all files in the files.exclude setting (#2171), projects will no longer load if too many files are exluded.

In my case, the files.exclude setting is around 6,400 characters long (depending on how it is serialized), which results in an error because the OmniSharp command line is too long.

According to this Windows support article, the maximum length is 8,191 characters and the only workaround is to pass the data via a local file instead.

As a workaround, users can downgrade to version 1.19.1 or shorten the number of files in their files.exclude setting.

Environment data

Steps to reproduce

Expected behavior

Actual behavior

OmniSharp server started. Path: C:\Users\….vscode\extensions\ms-vscode.csharp-1.20.0.omnisharp\1.32.20\OmniSharp.exe PID: 5076

Command line too long.

rchande commented 5 years ago

@stefanhamburger That's an amazing find. You can work around this by putting your exclude files in omnisharp.json (https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options) instead of in your VS Code settings. Obviously that won't help if you need those exclusions in VS Code too.

kthy commented 4 years ago

Yeah, no, that's not a workaround. I put the files in settings.json for a reason (namely that microsoft/vscode#38878 still isn't fixed).