Unable to debug in vs code

Viewed 1167

My issue is that I am unable to debug C# code in vs code. I am however able to build my projects and run my tests in the integrated terminal.

I get the following error message when I open a C# project:

Error when opening project

When I try to debug a test I get the following error:

Failed to start debugger: "System.ArgumentException: '' is not a valid version string.\nParameter name: value\n at NuGet.Versioning.SemanticVersion.Parse (System.String value) [0x0001c] in <4853a90612074646a7605745843002d3>:0 \n at OmniSharp.Services.DotNetCliService.GetVersion (System.String workingDirectory) [0x00011] in :0 \n at OmniSharp.DotNetTest.TestManager.Create (Microsoft.CodeAnalysis.Project project, OmniSharp.Services.IDotNetCliService dotNetCli, OmniSharp.Eventing.IEventEmitter eventEmitter, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) [0x0000c] in <4aaef988dc824a03ae865c14f4dd306d>:0 \n at OmniSharp.DotNetTest.TestManager.Start (Microsoft.CodeAnalysis.Project project, OmniSharp.Services.IDotNetCliService dotNetCli, OmniSharp.Eventing.IEventEmitter eventEmitter, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) [0x00000] in <4aaef988dc824a03ae865c14f4dd306d>:0 \n at OmniSharp.DotNetTest.Services.BaseTestService.CreateTestManager (System.String fileName) [0x00011] in <4aaef988dc824a03ae865c14f4dd306d>:0 \n at OmniSharp.DotNetTest.Services.DebugTestService.Handle (OmniSharp.DotNetTest.Models.DebugTestGetStartInfoRequest request) [0x00007] in <4aaef988dc824a03ae865c14f4dd306d>:0 \n at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler2[TRequest,TResponse].Handle (TRequest request) [0x00000] in <b0a7a1010bfe4b01af0da4ccbeac0c7a>:0 \n at OmniSharp.Endpoint.EndpointHandler2+d__18[TRequest,TResponse].MoveNext () [0x0008a] in :0 \n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0 \n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 \n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 \n at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <f3f2aa82c3a04d48845485ce37124803>:0 \n at OmniSharp.Endpoint.EndpointHandler2+d__16[TRequest,TResponse].MoveNext () [0x0024b] in :0 \n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0 \n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 \n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 \n at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in :0 \n at OmniSharp.Stdio.Host+d__13.MoveNext () [0x000e7] in <5e8e2ad26ef5465098aa876c7f625e58>:0 "

It seems as though these errors will be related to the same issue.

Here is my output for dotnet --info :

.NET Core SDK (reflecting any global.json): Version: 2.1.500 Commit: b68b931422

Runtime Environment: OS Name: Mac OS X OS Version: 10.13 OS Platform: Darwin RID: osx.10.13-x64 Base Path: /usr/local/share/dotnet/sdk/2.1.500/

Host (useful for support): Version: 2.1.6 Commit: 3f4f8eebd8

.NET Core SDKs installed: 2.1.500 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

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

Things I have tried:

  • closing and reopening vs code
  • creating a new C# project
  • Uninstalling and reinstalling vs code, dotnet runtimes and the SDK

Has anyone experienced this issue? If so please let me know how you resolved it?

I did create a bug report in the Omnisharp repo, it still has not been looked at. Someone seemed to think it is something do to with my PATH configuration.

0 Answers
Related