dotnet/vscode-csharp

OmniSharp fails to load when the path provided contains spaces.

Opened this issue · 3 comments

Environment data

dotnet --info output:

.NET SDK (reflecting any global.json):
 Version:   6.0.201     
 Commit:    ef40e6aa06  

Runtime Environment:    
 OS Name:     Windows   
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.201\

Host (useful for support):
  Version: 6.0.3
  Commit:  c24d9a9c91

.NET SDKs installed:
  6.0.200 [C:\Program Files\dotnet\sdk]
  6.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

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

VS Code version:
VSCode 1.66.0

C# Extension version:
Current latest as 4/3/22 (UTC -0300), that is v1.24.3

OmniSharp log

Starting OmniSharp server at 4/3/2022, 7:10:00 PM
    Target: c:\Users\Dottik\source\repos\Test Project\Test Project.sln

OmniSharp server started with .NET 6.0.201
.
    Path: c:\Users\Dottik\.vscode\extensions\ms-dotnettools.csharp-1.24.3-win32-x64\.omnisharp\1.38.2-net6.0\OmniSharp.dll
    PID: 7896

System.ArgumentException: OmniSharp only supports being launched with a directory path or a path to a solution (.sln, .slnf) file. (Parameter 'path')
   at OmniSharp.Services.OmniSharpEnvironment..ctor(String path, Int32 hostPid, LogLevel logLevel, String[] additionalArguments) in D:\a\1\s\src\OmniSharp.Host\Services\OmniSharpEnvironment.cs:line 38
   at OmniSharp.CommandLineApplicationExtensions.CreateEnvironment(CommandLineApplication application) in D:\a\1\s\src\OmniSharp.Host\CommandLineApplicationExtensions.cs:line 12
   at OmniSharp.Stdio.Driver.Program.<>c__DisplayClass0_1.<Main>b__1() in D:\a\1\s\src\OmniSharp.Stdio.Driver\Program.cs:line 49
   at OmniSharp.CommandLineApplication.<>c__DisplayClass12_0.<OnExecute>b__0() in D:\a\1\s\src\OmniSharp.Host\CommandLineApplication.cs:line 92
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass146_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at OmniSharp.CommandLineApplication.Execute(String[] args) in D:\a\1\s\src\OmniSharp.Host\CommandLineApplication.cs:line 65
   at OmniSharp.Stdio.Driver.Program.<>c__DisplayClass0_0.<Main>b__0() in D:\a\1\s\src\OmniSharp.Stdio.Driver\Program.cs:line 84
   at OmniSharp.HostHelpers.Start(Func`1 action) in D:\a\1\s\src\OmniSharp.Host\HostHelpers.cs:line 30

Steps to reproduce

Create a new project with a folder that contains spaces

Expected behavior

Analyze all files and provide intellisense autocomplete

Actual behavior

Omnisharp does not load, and does not work.

jtsom commented

Is this a new/changed behavior? I've been able to open projects with spaces in the path just fine.

Is this a new/changed behavior? I've been able to open projects with spaces in the path just fine.

Seems to affect launching O# when omnisharp.useModernNet is set to true.

A prerelease build is out with a fix for this issue. https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.24.4-beta1