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.

Omnisharp unit test debugging crashes (MacOS Catalina)

See original GitHub issue

Please paste the output from your clipboard## Issue Description ##

Steps to Reproduce

This behavior started immediately after installing dotnet 6 SDK via brew upgrade dotnet-sdk, which installed SDK 6.0.21

From command line:

❯ mkdir Testing ❯ cd Testing ❯ dotnet new sln ❯ dotnet new classlib -n TestingLib ❯ dotnet new xunit -n TestingTests ❯ dotnet sln add TestingLib ❯ dotnet sln add TestingTests ❯ cd TestingTests ❯ dotnet add reference …/TestingLib ❯ cd … ❯ code .

Next, add a public function to TestingLib.Class1 New up an instance of Class1 in TestingTests.UnitTest1.Test1()

Set a breakpoint, hover over method, click Debug Test

Expected Behavior

The breakpoint to hit

Failed to start debugger error

Actual Behavior

Logs

OmniSharp log

Failed to start debugger: "System.InvalidOperationException: The debugger could not be started\n at OmniSharp.DotNetTest.Services.DebugTestService.Handle (OmniSharp.DotNetTest.Models.DebugTestGetStartInfoRequest request) [0x00050] in <5e135b77c1bc4c358e7d29f74c6eda4e>:0 \n at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler`2[TRequest,TResponse].Handle (TRequest request) [0x00000] in <f325be76f3664621aaf9ae7e6a5789dd>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00022] in <f325be76f3664621aaf9ae7e6a5789dd>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <f325be76f3664621aaf9ae7e6a5789dd>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestP...

Starting OmniSharp server at 3/28/2022, 8:10:54 AM Target: /Users/AHanusa/work/Testing/Testing.sln

OmniSharp server started. Path: /Users/AHanusa/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/run PID: 13729

    Starting OmniSharp on MacOS 10.15.7 (x64)
    Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
    Using the 'dotnet' on the PATH.
    DotNetPath set to dotnet
    Located 1 MSBuild instance(s)
        1: StandAlone 17.1.0 - "/Users/AHanusa/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild/Current/Bin"
    MSBUILD_EXE_PATH environment variable set to '/Users/AHanusa/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
    Registered MSBuild instance: StandAlone 17.1.0 - "/Users/AHanusa/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild/Current/Bin"
        CscToolExe = csc.exe
        MSBuildToolsPath = /Users/AHanusa/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild/Current/Bin
        CscToolPath = /Users/AHanusa/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild/Current/Bin/Roslyn
        BypassFrameworkInstallChecks = true
        MSBuildExtensionsPath = /Users/AHanusa/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    Detecting Cake files in '/Users/AHanusa/work/Testing'.
    Did not find any Cake files
    Skip loading projects listed in solution file or under target directory because MsBuild:LoadProjectsOnDemand is true.
    Detecting CSX files in '/Users/AHanusa/work/Testing'.
    Did not find any CSX files
    Configuration finished.
    Omnisharp server running using Stdio at location '/Users/AHanusa/work/Testing' on host 13700.
    Queue project update for '/Users/AHanusa/work/Testing/TestingTests/TestingTests.csproj'
    Loading project: /Users/AHanusa/work/Testing/TestingTests/TestingTests.csproj
    Successfully loaded project file '/Users/AHanusa/work/Testing/TestingTests/TestingTests.csproj'.
    Adding project '/Users/AHanusa/work/Testing/TestingTests/TestingTests.csproj'
    Update project: TestingTests
    Found referenced project outside root directory: /Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj
    Adding project '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj'
    Queue project update for '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj'
    Loading project: /Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj
    Successfully loaded project file '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj'.
    Update project: TestingLib
    Adding analyzer reference: /usr/local/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll
    Adding analyzer reference: /usr/local/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.NetAnalyzers.dll
    Adding analyzer reference: /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Ref/6.0.3/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll
    No symbol found. File: /Users/AHanusa/work/Testing/TestingTests/UnitTest1.cs, Line: 0, Column: 0.
    Queue project update for '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj'
    Loading project: /Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj
    Successfully loaded project file '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj'.
    Update project: TestingLib

Received response for /v2/getcodeactions but could not find request. warn: OmniSharp.Stdio.Host ************ Request ************ { “Type”: “request”, “Seq”: 35, “Command”: “/v2/debugtest/getstartinfo”, “Arguments”: { “FileName”: “/Users/AHanusa/work/Testing/TestingTests/UnitTest1.cs”, “MethodName”: “TestingTests.UnitTest1.Test1”, “TestFrameworkName”: “xunit”, “TargetFrameworkVersion”: “.NETCoreApp,Version=v6.0”, “NoBuild”: false } } [fail]: OmniSharp.Stdio.Host ************ Response (2564.9937ms) ************ { “Request_seq”: 35, “Command”: “/v2/debugtest/getstartinfo”, “Running”: true, “Success”: false, “Message”: “"System.InvalidOperationException: The debugger could not be started\n at OmniSharp.DotNetTest.Services.DebugTestService.Handle (OmniSharp.DotNetTest.Models.DebugTestGetStartInfoRequest request) [0x00050] in <5e135b77c1bc4c358e7d29f74c6eda4e>:0 \n at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler2[TRequest,TResponse].Handle (TRequest request) [0x00000] in <f325be76f3664621aaf9ae7e6a5789dd>:0 \\n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler2[TRequest,TResponse][] handlers, TRequest request) [0x00022] in <f325be76f3664621aaf9ae7e6a5789dd>:0 \\n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <f325be76f3664621aaf9ae7e6a5789dd>: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 <f325be76f3664621aaf9ae7e6a5789dd>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000f3] in <53cdc2cf95d3416bbae3409faa4eb825>:0 "”, “Body”: null, “Seq”: 4305, “Type”: “response” }

C# log

NOTE: From .NET Test Log Notice the ref in the path below. If I create a bin/ref directory and copy the TestingLib.dll into it, the debugger works appropriately.

/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error MSB3883: Unexpected exception: [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : DirectoryNotFoundException: Could not find a part of the path ‘/Users/AHanusa/work/Testing/TestingLib/bin/Debug/net6.0/ref/TestingLib.dll’. [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func2 errorRewriter) [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Interop.CheckIo(Error error, String path, Boolean isDirectory, Func2 errorRewriter) [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite) [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite) [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Microsoft.CodeAnalysis.BuildTasks.CopyRefAssembly.Copy() [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj] /usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : [/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj]

Environment information

VSCode version: 1.65.2 C# Extension: 1.24.1

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.201 Commit: ef40e6aa06

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/6.0.201/

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

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

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

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

Visual Studio Code Extensions
Extension Author Version
birds-of-paradise Programming-Engineer 0.0.10
csharp ms-dotnettools 1.24.1
csharpextensions jchannon 1.3.1
EditorConfig EditorConfig 0.16.4
gitblame waderyan 8.1.0
ng-template Angular 13.3.0
path-intellisense christian-kohler 2.8.0
powershell ms-vscode 2021.12.0
remote-containers ms-vscode-remote 0.224.3
Theme-BirdsofParadise gerane 0.0.5
theme-github thomaspink 1.0.1
Theme-peacocks-in-space gerane 0.0.5
trailing-spaces shardulm94 0.3.1
vim vscodevim 1.22.2
vscode-commons redhat 0.0.6
vscode-docker ms-azuretools 1.21.0
vscode-dotnet-runtime ms-dotnettools 1.5.0
vscode-nuget-gallery patcx 0.0.24
vscode-resx-editor DominicVonk 0.0.5
vscode-theme-onelight akamud 2.2.3
vscode-yaml redhat 1.5.1

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:22 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Apr 28, 2022

Any progress? I got a similar issue on ubuntu 22.04 (on 20.04 too), using .net5 and xunit 2.4.2-pre.12:

[fail]: OmniSharp.Stdio.Host
        ************  Response (35.0185ms) ************ 
{
  "Request_seq": 1013,
  "Command": "/v2/debugtest/getstartinfo",
  "Running": true,
  "Success": false,
  "Message": "\"System.FormatException: version\\n  at OmniSharp.SemanticVersion.Parse (System.String version) [0x0001b] in <04928efb700c47abb8cc2114b31a9ccb>:0 \\n  at OmniSharp.Services.DotNetCliService.GetVersion (System.String workingDirectory) [0x00011] in <3d93fabea6954f4ba147450b0cf4332a>: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 <9d87b466e5a04dffb95becc0b4dfd560>: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 <9d87b466e5a04dffb95becc0b4dfd560>:0 \\n  at OmniSharp.DotNetTest.Services.BaseTestService.CreateTestManager (System.String fileName, System.Boolean noBuild) [0x00011] in <9d87b466e5a04dffb95becc0b4dfd560>:0 \\n  at OmniSharp.DotNetTest.Services.DebugTestService.Handle (OmniSharp.DotNetTest.Models.DebugTestGetStartInfoRequest request) [0x0000d] in <9d87b466e5a04dffb95becc0b4dfd560>:0 \\n  at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler`2[TRequest,TResponse].Handle (TRequest request) [0x00000] in <3d93fabea6954f4ba147450b0cf4332a>:0 \\n  at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00022] in <3d93fabea6954f4ba147450b0cf4332a>:0 \\n  at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <3d93fabea6954f4ba147450b0cf4332a>: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 <3d93fabea6954f4ba147450b0cf4332a>:0 \\n  at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000f3] in <2584067dfcea42a69c19a025cfbc4799>:0 \"",
  "Body": null,
  "Seq": 3637,
  "Type": "response"
}
0reactions
hannahchancommented, Jun 13, 2022

Hi all,

Debugging in vscode started working for me again. I’ve tested on macOS and in a Linux container. This might have been accidentally fixed. Can a few other people verify?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugger crash on .NET Core xUnit.Net tests
macOS 10.12.5, .NET Core 1.1.1, SDK 1.0.4. xUnit.Net test discovery and runner works fine, but when I try to debug it, debugger crashes/stop...
Read more >
What's new in Unity 2020.1.0 Beta 5
MacOS : [macOS] Editor crashes when trying to access audio capture ... Editor: Fixed playmode test project ComputeShaders fails in debug ...
Read more >
Unreal Engine 4.26 Release Notes
New: Added unit tests when exiting a branch due to a parent decorator failure to ... binary with a version that fixes a...
Read more >
You are running 'create-react-app' 4.0.3, which is behind the ...
MacBook Pro Monterey and Catalina Crashes and Reboots overnight → ... ThenBy · Twiiter BootStrap · TypeScript · Unit Testing · Unit Tests...
Read more >
I Was Wrong about Nix | Hacker News
Be limited while debugging locally because all debugging must happen over a network connection. Today: Install Nix. Run build.sh. Run test.sh.
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