dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.84k stars 663 forks source link

[fail] OmniSharp.Stdio.Host #4370

Open DrewRidley opened 3 years ago

DrewRidley commented 3 years ago

Issue Description

Steps to Reproduce

Expected Behavior

Actual Behavior

Logs

OmniSharp log

OmniSharp server started. Path: c:\Users\Drew.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5\OmniSharp.exe PID: 1144

    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    DotNetPath set to dotnet
    Located 2 MSBuild instance(s)
        1: Visual Studio Build Tools 2019 16.8.30907.101 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"
        2: StandAlone 16.8.0 - "c:\Users\Drew\.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin"
    It looks like you have Visual Studio 2019 installed without .NET Core SDK support which is required by OmniSharp.

Try updating Visual Studio 2019 installation with .NET Core SDK to enable better MSBuild support.

    MSBUILD_EXE_PATH environment variable set to 'c:\Users\Drew\.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin\MSBuild.exe'
    Registered MSBuild instance: StandAlone 16.8.0 - "c:\Users\Drew\.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin"
        CscToolExe = csc.exe
        CscToolPath = c:\Users\Drew\.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin\Roslyn
        MSBuildExtensionsPath = c:\Users\Drew\.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild
        MSBuildToolsPath = c:\Users\Drew\.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin
    Detecting Cake files in 'e:\Projects\HQBot'.
    Could not find any Cake files
    No solution files found in 'e:\Projects\HQBot'
    Queue project update for 'e:\Projects\HQBot\HQBot.csproj'
    Detecting CSX files in 'e:\Projects\HQBot'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Loading project: e:\Projects\HQBot\HQBot.csproj
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
    Configuration finished.
    Omnisharp server running using Stdio at location 'e:\Projects\HQBot' on host 7048.
    Project dependency Newtonsoft.Json does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
    Package 'Newtonsoft.Json 3.5.8' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
    Successfully loaded project file 'e:\Projects\HQBot\HQBot.csproj'.

e:\Projects\HQBot\HQBot.csproj e:\Projects\HQBot\HQBot.csproj(0,0): Error: Project dependency Newtonsoft.Json does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. e:\Projects\HQBot\HQBot.csproj(0,0): Error: Package 'Newtonsoft.Json 3.5.8' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.

    Adding project 'e:\Projects\HQBot\HQBot.csproj'
    Update project: HQBot
    ************  Response ************ 

{ "Request_seq": 6, "Command": "/v2/getcodeactions", "Running": true, "Success": false, "Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\r\nParameter name: index\r\n at Microsoft.CodeAnalysis.Text.SourceText.LineInfo.get_Item(Int32 index)\r\n at OmniSharp.Extensions.TextExtensions.GetPositionFromLineAndOffset(SourceText text, Int32 lineNumber, Int32 offset) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn\\Extensions\\TextExtensions.cs:line 26\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.GetTextSpan(ICodeActionRequest request, SourceText sourceText) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Refactoring\\\\V2\\\\BaseCodeActionService.cs:line 124\\r\\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.BaseCodeActionService2.d10.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\BaseCodeActionService.cs:line 91\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService.d1.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Refactoring\\V2\\GetCodeActionsService.cs:line 32\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler2.<GetFirstNotEmptyResponseFromHandlers>d__19.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n at OmniSharp.Endpoint.EndpointHandler2.d20.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 230\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler`2.d16.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 131\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Stdio.Host.d__13.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 215\"", "Body": null, "Seq": 35, "Type": "response" }

C# log

N/A (empty).

Environment information

VSCode version: 1.53.0-insider C# Extension: 1.23.8

Dotnet Information .NET SDK (reflecting any global.json): Version: 5.0.102 Commit: 71365b4d42 Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.102\ Host (useful for support): Version: 5.0.2 Commit: cb5f173b96 .NET SDKs installed: 5.0.102 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |csharp|ms-dotnettools|1.23.8| |docomment|k--kato|0.1.20| |even-better-toml|tamasfe|0.10.0| |remote-wsl|ms-vscode-remote|0.53.2| |reui|barrsan|1.1.4| |rust|rust-lang|0.7.8|;
filipw commented 3 years ago

Please describe the problem you are seeing as specified in the issue template. Thanks.

DrewRidley commented 3 years ago

The problem I am having is that OmniSharp does not load, and does not provide code analysis on the files. I would expect it to load successfully, but it does not. As for reproducing it, I am not really sure at this moment of a strategy but I would assume it has to do with my project or the fact that I am using vscode insiders.

filipw commented 3 years ago

according to the logs, the project file seems to be invalid

[warn]: OmniSharp.MSBuild.ProjectLoader
Project dependency Newtonsoft.Json does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
[warn]: OmniSharp.MSBuild.ProjectLoader
Package 'Newtonsoft.Json 3.5.8' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'e:\Projects\HQBot\HQBot.csproj'.
e:\Projects\HQBot\HQBot.csproj
e:\Projects\HQBot\HQBot.csproj(0,0): Error: Project dependency Newtonsoft.Json does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
e:\Projects\HQBot\HQBot.csproj(0,0): Error: Package 'Newtonsoft.Json 3.5.8' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.