question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XUnit Failed to start debugger: "System.ArgumentException: '' is not a valid version string when click on Debug Test link in code

See original GitHub issue
## Issue Description ##
Receive the following exception when click on Debug Test in VSCode:

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 <abdc5737ab7e41cea3dac044b117a5e1>:0 \n at OmniSharp.Services.DotNetCliService.GetVersion (System.String workingDirectory) [0x00011] in <f74664677128467483a2d7d479fee8cd>: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 <273b8594db1b4c2b8cba30203f5465f6>:0 \n at OmniSharp.DotNetTest.TestManager.Start (Microsoft.CodeAnalysis.Project project, OmniSharp.Services.IDotNetCliService dotNetCli, OmniSharp.Eventing.IEventEmitter eventEmitter, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Boolean noBuild) [0x00000] in <273b8594db1b4c2b8cba30203f5465f6>:0 \n at OmniSharp.DotNetTest.Services.BaseTestService.CreateTestManager (System.String fileName, System.Boolean noBuild) [0x00011] in <273b8594db1b4c2b8cba30203f5465f6>:0 \n at OmniSharp.DotNetTest.Services.DebugTestService.Handle (OmniSharp.DotNetTest.Models.DebugTestGetStartInfoRequest request) [0x0000d] in <273b8594db1b4c2b8cba30203f5465f6>:0 \n at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler2[TRequest,TResponse].Handle (TRequest request) [0x00000] in <f74664677128467483a2d7d479fee8cd>:0 \n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler2[TRequest,TResponse][] handlers, TRequest request) [0x00022] in <f74664677128467483a2d7d479fee8cd>:0 \n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <f74664677128467483a2d7d479fee8cd>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <f74664677128467483a2d7d479fee8cd>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000e7] in <25283e844b74454aa89c7ebce6d25dc5>:0 "

## Steps to Reproduce ##
Created a xunit project with ```dotnet new xunit```

With these packages installed:
``` xml
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
    <PackageReference Include="xunit" Version="2.4.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
    <PackageReference Include="coverlet.collector" Version="1.2.0" />
  </ItemGroup>

Created an XUnit test class and a Collection fixture.

Expected Behavior

Able to debug the test

Actual Behavior

Fails with exception provided above

Logs

OmniSharp log

Post the output from Output-->OmniSharp log here

C# log

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 <abdc5737ab7e41cea3dac044b117a5e1>:0 \n at OmniSharp.Services.DotNetCliService.GetVersion (System.String workingDirectory) [0x00011] in <f74664677128467483a2d7d479fee8cd>: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 <273b8594db1b4c2b8cba30203f5465f6>:0 \n at OmniSharp.DotNetTest.TestManager.Start (Microsoft.CodeAnalysis.Project project, OmniSharp.Services.IDotNetCliService dotNetCli, OmniSharp.Eventing.IEventEmitter eventEmitter, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Boolean noBuild) [0x00000] in <273b8594db1b4c2b8cba30203f5465f6>:0 \n at OmniSharp.DotNetTest.Services.BaseTestService.CreateTestManager (System.String fileName, System.Boolean noBuild) [0x00011] in <273b8594db1b4c2b8cba30203f5465f6>:0 \n at OmniSharp.DotNetTest.Services.DebugTestService.Handle (OmniSharp.DotNetTest.Models.DebugTestGetStartInfoRequest request) [0x0000d] in <273b8594db1b4c2b8cba30203f5465f6>:0 \n at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler`2[TRequest,TResponse].Handle (TRequest request) [0x00000] in <f74664677128467483a2d7d479fee8cd>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00022] in <f74664677128467483a2d7d479fee8cd>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <f74664677128467483a2d7d479fee8cd>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <f74664677128467483a2d7d479fee8cd>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000e7] in <25283e844b74454aa89c7ebce6d25dc5>:0 "

Environment information

VSCode version: 1.48.0 C# Extension: 1.23.1

Mono Information OmniSharp using built-in mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.302 Commit: 41faccf259

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

Host (useful for support): Version: 3.1.6 Commit: 3acd9b0cd1

.NET Core SDKs installed: 3.1.101 [/usr/local/share/dotnet/sdk] 3.1.102 [/usr/local/share/dotnet/sdk] 3.1.302 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

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

Visual Studio Code Extensions
Extension Author Version
csharp ms-dotnettools 1.23.1
dotenv mikestead 1.0.1
go golang 0.16.1
mssql ms-mssql 1.9.0
vscode-docker ms-azuretools 1.5.0
vscode-eslint dbaeumer 2.1.8
vscode-postgres ckolkman 1.1.11
vscode-proto3 zxh404 0.4.2
vscode-rufo jnbt 0.0.1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

2reactions
josteinkcommented, Dec 9, 2020

I’m on latest VSCode and can still reproduce this error.

Currently no tests in my projects are debuggable.

1reaction
BryanWilhitecommented, Dec 27, 2020

i rebuilt my test project file by file after running dotnet new and everything runs correctly on Linux; the only difference was the version of Microsoft.NET.Test.Sdk: 16.7.1 works, 16.8.3 is suspect

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot debug C# tests with visual studio code on linux
I had a similar problem (VSCode, Linux, not a valid version string, though mine was null, not an empty string, mstest).
Read more >
Can't debug unit tests: System.Runtime.InteropServices ...
Specifically, the bug was that starting a unit test debug session from either the Test Explorer or the inline button under the [Fact]...
Read more >
Visual Studio 2019 version 16.5 Release Notes | Microsoft Learn
Fixed an issue where the Diagnostic Tools while debugging and Performance Profiler fail to launch on XBox devices. Release Notes Icon Visual ...
Read more >
How to fix common Selenium errors? - Ultimate QA
System.InvalidOperationException : unknown error: Element is not ... If you go to ultimateqa.wpmudev.host and try to click the Start Here ...
Read more >
C# – Carpe Diem Systems Ltd.
I have a .Net 5 WinForms Control library (Windows 10, Visual Studio 2019) and want to add some unit tests for the non-UI...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found