dotnet / vscode-csharp

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

Extension not working with .NET Core 5.0 #4275

Open fmuntean opened 3 years ago

fmuntean commented 3 years ago

Starting MSBuild language service... Failed to start the MSBuild language server. Error: Command failed: "C:\Program Files\dotnet\dotnet.EXE" "c:\Users\u1.vscode\extensions\tintoy.msbuild-project-tools-0.3.10\out\language-server\MSBuildProjectTools.LanguageServer.Host.dll" --probe It was not possible to find any compatible framework version The framework 'Microsoft.NETCore.App', version '3.0.0' was not found.

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:

It was not possible to find any compatible framework version The framework 'Microsoft.NETCore.App', version '3.0.0' was not found.

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:

OmniSharp log

Post the output from Output-->OmniSharp log here

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.51.1 C# Extension: 1.23.6

Dotnet Information .NET SDK (reflecting any global.json): Version: 5.0.100 Commit: 5044b93829 Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.100\ Host (useful for support): Version: 5.0.0 Commit: cf258a14b7 .NET SDKs installed: 5.0.100 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.0 [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| |---|---|---| |angular-console|nrwl|15.0.0| |angular-essentials|johnpapa|9.0.1| |Angular2|johnpapa|9.1.2| |azure-account|ms-vscode|0.9.4| |azure-iot-edge|vsciot-vscode|1.23.0| |azure-iot-toolkit|vsciot-vscode|2.16.4| |azure-iot-tools|vsciot-vscode|0.3.0| |code-gnu-global|austin|0.2.2| |cpptools|ms-vscode|1.1.3| |csharp|ms-dotnettools|1.23.6| |debugger-for-chrome|msjsdiag|4.12.11| |debugger-for-edge|msjsdiag|1.0.15| |EditorConfig|EditorConfig|0.16.4| |hsm-post-processor|Autodesk|3.4.0| |jupyter|ms-toolsai|2020.11.399280825| |material-icon-theme|PKief|4.4.0| |msbuild-project-tools|tintoy|0.3.10| |msbuild-tools|sterin|0.0.12| |nc-gcode|ML2|0.14.1| |ng-template|Angular|0.1100.2| |platformio-ide|platformio|2.2.1| |prettier-vscode|esbenp|5.8.0| |python|ms-python|2020.11.371526539| |remote-containers|ms-vscode-remote|0.148.1| |remote-ssh|ms-vscode-remote|0.56.0| |remote-ssh-edit|ms-vscode-remote|0.58.0| |remote-wsl|ms-vscode-remote|0.51.4| |restructuredtext|lextudio|130.0.0| |uncrustify|LaurentTreguier|2.20.6| |vscode-eslint|dbaeumer|2.1.13| |vscode-iot-device-cube|vsciot-vscode|0.3.0| |vscode-iot-workbench|vsciot-vscode|0.16.0| |vscode-npm-script|eg2|0.3.13| |vscode-peacock|johnpapa|3.9.1| |vscode-remote-extensionpack|ms-vscode-remote|0.20.0| |winteriscoming|johnpapa|1.4.3|;
JoeRobich commented 3 years ago

@fmuntean Sorry you are running into issues after updating. From the log you shared,

Error: Command failed: "C:\Program Files\dotnet\dotnet.EXE" "c:\Users\u1.vscode\extensions\tintoy.msbuild-project-tools-0.3.10\out\language-server\MSBuildProjectTools.LanguageServer.Host.dll" --probe

It seems it is the msbuild-project-tools (v0.3.10) extension which is failing to start.

fmuntean commented 3 years ago

@fmuntean Sorry you are running into issues after updating. From the log you shared,

Error: Command failed: "C:\Program Files\dotnet\dotnet.EXE" "c:\Users\u1.vscode\extensions**tintoy.msbuild-project-tools-0.3.10**\out\language-server\MSBuildProjectTools.LanguageServer.Host.dll" --probe

It seems it is the msbuild-project-tools (v0.3.10) extension which is failing to start.

even after removing that extension and restarting VSCODE is still not working

JoeRobich commented 3 years ago

@fmuntean Can you share the OmniSharp Log from the Output pane?

fmuntean commented 3 years ago

@fmuntean Can you share the OmniSharp Log from the Output pane?

OmniSharp server started. Path: c:\Users\fmunt.vscode\extensions\ms-dotnettools.csharp-1.23.7.omnisharp\1.37.4\OmniSharp.exe PID: 14448

    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    DotNetPath set to dotnet
    Located 1 MSBuild instance(s)
        1: StandAlone 16.8.0 - "c:\Users\...\.vscode\extensions\ms-dotnettools.csharp-1.23.7\.omnisharp\1.37.4\.msbuild\Current\Bin"
    MSBUILD_EXE_PATH environment variable set to 'c:\Users\....\.vscode\extensions\ms-dotnettools.csharp-1.23.7\.omnisharp\1.37.4\.msbuild\Current\Bin\MSBuild.exe'
    Registered MSBuild instance: StandAlone 16.8.0 - "c:\Users\...\.vscode\extensions\ms-dotnettools.csharp-1.23.7\.omnisharp\1.37.4\.msbuild\Current\Bin"
        CscToolExe = csc.exe
        CscToolPath = c:\Users\...\.vscode\extensions\ms-dotnettools.csharp-1.23.7\.omnisharp\1.37.4\.msbuild\Current\Bin\Roslyn
        MSBuildExtensionsPath = c:\Users\...\.vscode\extensions\ms-dotnettools.csharp-1.23.7\.omnisharp\1.37.4\.msbuild
        MSBuildToolsPath = c:\Users\...\.vscode\extensions\ms-dotnettools.csharp-1.23.7\.omnisharp\1.37.4\.msbuild\Current\Bin
    Detecting Cake files in 'd:\git\...'.
    Could not find any Cake files
    No solution files found in 'd:\git\...'
    Queue project update for 'd:\git\...\services\IndexCli\indexcli.csproj'
    Queue project update for 'd:\git\...\services\Indexer\Indexer.csproj'
    Queue project update for 'd:\git\...\services\MediaLibrary\MediaLibrary.csproj'
    Queue project update for 'd:\git\...\services\MediaLibraryDB\MediaLibraryDB.csproj'
    Queue project update for 'd:\git\...\services\MediaLibraryMem\MediaLibraryMem.csproj'
    Queue project update for 'd:\git\...\services\...\Services.csproj'
    Detecting CSX files in 'd:\git\...'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Loading project: d:\git\...\services\IndexCli\indexcli.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 'd:\git\...' on host 14504.

.....

    Successfully loaded project file 'd:\git\....Services.csproj'.
    Adding project 'd:\git\.....csproj'
    Update project: indexcli
    Update project: Indexer
    Update project: MediaLibrary
    Update project: MediaLibraryDB
    Update project: MediaLibraryMem
    Update project: Services
    ************  Response ************ 

{ "Request_seq": 32, "Command": "/v2/highlight", "Running": true, "Success": false, "Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\r\nParameter name: character\r\n at Microsoft.CodeAnalysis.Text.LinePosition..ctor(Int32 line, Int32 character)\r\n at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.d1.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\SemanticHighlight\\SemanticHighlightService.cs:line 36\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.d19.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.<HandleRequestForLanguage>d__20.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.EndpointHandler2.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.d13.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 215\"", "Body": null, "Seq": 103, "Type": "response" }

    Solution initialized -> queue all documents for code analysis. Initial document count: 37.
    ************  Response ************ 

{ "Request_seq": 43, "Command": "/v2/highlight", "Running": true, "Success": false, "Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\r\nParameter name: character\r\n at Microsoft.CodeAnalysis.Text.LinePosition..ctor(Int32 line, Int32 character)\r\n at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.d1.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\SemanticHighlight\\SemanticHighlightService.cs:line 36\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.d19.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.<HandleRequestForLanguage>d__20.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.EndpointHandler2.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.d13.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 215\"", "Body": null, "Seq": 119, "Type": "response" }

filipw commented 3 years ago

@fmuntean what is not working then?

The original error in this issue doesn't come from OmniSharp, it is from the msbuild-project-tools extension.

johnathaningle commented 3 years ago

I have been getting the same errors. On windows 10 with VSCode. When creating the default console application with .NET 5.0 ("dotnet new console") the project fails to load.

Here is the output from the OmniSharpLog: `Starting OmniSharp server at 12/28/2020, 7:49:04 AM Target: c:\src\CSharp\Tag\Tag.Backup.Win

OmniSharp server started. Path: c:\Users\John Ingle.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.6-beta.7\OmniSharp.exe PID: 4172

    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    DotNetPath set to dotnet
    Located 2 MSBuild instance(s)
        1: Visual Studio Community 2019 16.7.30503.244 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
        2: StandAlone 16.8.0 - "c:\Users\John Ingle\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.6-beta.7\.msbuild\Current\Bin"
    Registered MSBuild instance: Visual Studio Community 2019 16.7.30503.244 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
    Detecting Cake files in 'c:\src\CSharp\Tag\Tag.Backup.Win'.
    Could not find any Cake files
    No solution files found in 'c:\src\CSharp\Tag\Tag.Backup.Win'
    Queue project update for 'c:\src\CSharp\Tag\Tag.Backup.Win\TagBackWin.csproj'
    Detecting CSX files in 'c:\src\CSharp\Tag\Tag.Backup.Win'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Loading project: c:\src\CSharp\Tag\Tag.Backup.Win\TagBackWin.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 'c:\src\CSharp\Tag\Tag.Backup.Win' on host 13532.
    The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
    Failed to load project file 'c:\src\CSharp\Tag\Tag.Backup.Win\TagBackWin.csproj'.

c:\src\CSharp\Tag\Tag.Backup.Win\TagBackWin.csproj C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1177,5): Error: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

    Attempted to update project that is not loaded: c:\src\CSharp\Tag\Tag.Backup.Win\TagBackWin.csproj`
johnathaningle commented 3 years ago

For reference, everything works again if I downgrade my project from "net5.0" to "netcoreapp3.1" image This leads me to believe that something in OmniSharp is incompatible with the new version of dotnet.

filipw commented 3 years ago

in your case you have an outdated VS 2019 installation with MSBuild 16.7 - which doesn't support .NET 5.0

OmniSharp will use VS MSBuild if VS is installed on the machine. You should update VS 2019 to the latest version or create omnisharp.json file at the root of your workspace with the following content:

{
   "msbuild": {
       "useBundledOnly": true
   }
}

to force OmniSharp to skip VS 2019 MSBuild. This setting can also be enabled globally if omnisharp.json is created at %USERPROFILE%/.omnisharp/omnisharp.json.