vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Omnisharp unit test debugging crashes (MacOS Catalina)

Open ahanusa opened this issue 3 years ago • 22 comments

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 :0 \n at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler`2[TRequest,TResponse].Handle (TRequest request) [0x00000] in :0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00022] in :0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in :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) info: OmniSharp.Services.DotNetCliService Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK info: OmniSharp.Services.DotNetCliService Using the 'dotnet' on the PATH. info: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet info: OmniSharp.MSBuild.Discovery.MSBuildLocator 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" info: OmniSharp.MSBuild.Discovery.MSBuildLocator 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' info: OmniSharp.MSBuild.Discovery.MSBuildLocator 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 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110 info: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in '/Users/AHanusa/work/Testing'. info: OmniSharp.Cake.CakeProjectSystem Did not find any Cake files info: OmniSharp.MSBuild.ProjectSystem Skip loading projects listed in solution file or under target directory because MsBuild:LoadProjectsOnDemand is true. info: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in '/Users/AHanusa/work/Testing'. info: OmniSharp.Script.ScriptProjectSystem Did not find any CSX files info: OmniSharp.WorkspaceInitializer Configuration finished. info: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location '/Users/AHanusa/work/Testing' on host 13700. info: OmniSharp.MSBuild.ProjectManager Queue project update for '/Users/AHanusa/work/Testing/TestingTests/TestingTests.csproj' info: OmniSharp.MSBuild.ProjectManager Loading project: /Users/AHanusa/work/Testing/TestingTests/TestingTests.csproj info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/Users/AHanusa/work/Testing/TestingTests/TestingTests.csproj'. info: OmniSharp.MSBuild.ProjectManager Adding project '/Users/AHanusa/work/Testing/TestingTests/TestingTests.csproj' info: OmniSharp.MSBuild.ProjectManager Update project: TestingTests info: OmniSharp.MSBuild.ProjectManager Found referenced project outside root directory: /Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj info: OmniSharp.MSBuild.ProjectManager Adding project '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj' info: OmniSharp.MSBuild.ProjectManager Queue project update for '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj' info: OmniSharp.MSBuild.ProjectManager Loading project: /Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj'. info: OmniSharp.MSBuild.ProjectManager Update project: TestingLib info: OmniSharp.OmniSharpWorkspace Adding analyzer reference: /usr/local/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll info: OmniSharp.OmniSharpWorkspace Adding analyzer reference: /usr/local/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.NetAnalyzers.dll info: OmniSharp.OmniSharpWorkspace Adding analyzer reference: /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Ref/6.0.3/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll [warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService No symbol found. File: /Users/AHanusa/work/Testing/TestingTests/UnitTest1.cs, Line: 0, Column: 0. info: OmniSharp.MSBuild.ProjectManager Queue project update for '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj' info: OmniSharp.MSBuild.ProjectManager Loading project: /Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/Users/AHanusa/work/Testing/TestingLib/TestingLib.csproj'. info: OmniSharp.MSBuild.ProjectManager 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 :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 :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

ahanusa avatar Mar 28 '22 14:03 ahanusa

Thanks for reporting we will investigate. If I am getting it right there is no custom code or libraries used here, just the default code from test template?

nohwnd avatar Mar 29 '22 16:03 nohwnd

Correct. Thanks for looking into it!

On Tue, Mar 29, 2022, 11:22 AM Jakub Jareš @.***> wrote:

Thanks for reporting we will investigate. If I am getting it right there is no custom code or libraries used here, just the default code from test template?

— Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-vscode/issues/5128#issuecomment-1082089797, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJK34MPXIOG4JHI6ZHAWK3VCMU33ANCNFSM5R3MOXVA . You are receiving this because you authored the thread.Message ID: @.***>

ahanusa avatar Mar 29 '22 17:03 ahanusa

I have the same issue. Similar to https://github.com/OmniSharp/omnisharp-vscode/issues/4021

basvandriel avatar Apr 08 '22 13:04 basvandriel

@basvandriel Is the debugger trying to find the assembly in this directory?

bin/Debug/net6.0/ref/

Notice the 'ref' in the path. Not sure why it's looking there, as that directory isn't generated on build for me.

If you create the 'ref' directory and copy the assembly that you're trying to test into it, the debugger should work.

Definitely not an ideal solution however. Hope this gets resolved soon.

ahanusa avatar Apr 08 '22 14:04 ahanusa

@ahanusa It appears to be failing on the Received response for /findusages but could not find request. line. The test file does exist though.


Starting OmniSharp server at 4/8/2022, 4:33:59 PM
    Target: /home/bas/libs/grafiek.net/grafiek.net.sln

OmniSharp server started with .NET 6.0.201
.
    Path: /home/bas/.vscode-server/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2-net6.0/OmniSharp.dll
    PID: 21430

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: .NET Core SDK 6.0.201 17.1.0 - "/usr/share/dotnet/sdk/6.0.201/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 6.0.201 17.1.0 - "/usr/share/dotnet/sdk/6.0.201/"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/bas/libs/grafiek.net/grafiek.net.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/bas/libs/grafiek.net/src/Core/Core.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/bas/libs/grafiek.net/test/Core.Tests/Core.Tests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/bas/libs/grafiek.net/src/Language/Language.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/bas/libs/grafiek.net/test/Language.Test/Language.Test.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/bas/libs/grafiek.net'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/bas/libs/grafiek.net' on host 21295.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/bas/libs/grafiek.net/src/Core/Core.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/bas/libs/grafiek.net/src/Core/Core.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/bas/libs/grafiek.net/src/Core/Core.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/bas/libs/grafiek.net/test/Core.Tests/Core.Tests.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/bas/libs/grafiek.net/test/Core.Tests/Core.Tests.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/bas/libs/grafiek.net/test/Core.Tests/Core.Tests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/bas/libs/grafiek.net/src/Language/Language.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/bas/libs/grafiek.net/src/Language/Language.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/bas/libs/grafiek.net/src/Language/Language.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/bas/libs/grafiek.net/test/Language.Test/Language.Test.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/bas/libs/grafiek.net/test/Language.Test/Language.Test.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/bas/libs/grafiek.net/test/Language.Test/Language.Test.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Core
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Core.Tests
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Language
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Language.Test
Received response for /v2/codestructure but could not find request.
Received response for /quickinfo but could not find request.
[info]: OmniSharp.DotNetTest.VSTestManager
        read: {"MessageType":"TestSession.Connected","Payload":null}
[info]: OmniSharp.DotNetTest.VSTestManager
        read: {"MessageType":"ProtocolVersion","Payload":1}
[info]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session started.
[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
        No symbol found. File: /home/bas/libs/grafiek.net/test/Language.Test/LexerTest.cs, Line: 0, Column: 0.
Received response for /findusages but could not find request.
Killed

basvandriel avatar Apr 08 '22 14:04 basvandriel

@basvandriel what does your c# log look like?

ahanusa avatar Apr 08 '22 14:04 ahanusa

@ahanusa The .NET and C# log are both empty. The .NET Test Log contains the following;

----- Debugging test method Language.Test.LexerTest.TestIgnoringWhiteSpace -----

Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Language -> /home/bas/libs/grafiek.net/src/Language/bin/Debug/net6.0/Language.dll
  Language.Test -> /home/bas/libs/grafiek.net/test/Language.Test/bin/Debug/net6.0/Language.Test.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.82


[xUnit.net 00:00:00.01] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 6.0.3)
[xUnit.net 00:00:00.89]   Discovering: Language.Test
[xUnit.net 00:00:00.98]   Discovered:  Language.Test
Started debugging process #23781.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 6.0.3)
[xUnit.net 00:00:03.22]   Starting:    Language.Test
[xUnit.net 00:00:09.78]   Finished:    Language.Test
Debugging complete.

----- Debugging test method Language.Test.LexerTest.TestIgnoringWhiteSpace -----

Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Language -> /home/bas/libs/grafiek.net/src/Language/bin/Debug/net6.0/Language.dll
  Language.Test -> /home/bas/libs/grafiek.net/test/Language.Test/bin/Debug/net6.0/Language.Test.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.85


[xUnit.net 00:00:00.01] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 6.0.3)
[xUnit.net 00:00:01.01]   Discovering: Language.Test
[xUnit.net 00:00:01.10]   Discovered:  Language.Test
Started debugging process #23962.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 6.0.3)
[xUnit.net 00:00:02.49]   Starting:    Language.Test
[xUnit.net 00:00:06.23]   Finished:    Language.Test
Debugging complete.

basvandriel avatar Apr 08 '22 14:04 basvandriel

Has any progress been made on this issue? This bug is pretty crippling to my workflow :(

ahanusa avatar Apr 22 '22 15:04 ahanusa

Just a reminder that the culprit seems to be that the assemblies to debug are assumed to live in a ref directory, but no such directory exists.

Screen Shot 2022-04-27 at 8 40 31 AM

ahanusa avatar Apr 27 '22 13:04 ahanusa

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"
}

ghost avatar Apr 28 '22 03:04 ghost

Same here :(

ThiagoT1 avatar May 03 '22 00:05 ThiagoT1

I've been experiencing this as well. It's crippling my C# workflow on macOS on a .NET 6 project. I wish I knew how to fix this.

hannahchan avatar May 08 '22 11:05 hannahchan

I've been using Visual Studio for Mac solely for UT debugging purposes. It works just fine. However, having 2 editors/IDEs open for different purposes is hugely annoying.

ahanusa avatar May 08 '22 12:05 ahanusa

I solved my problem on Ubuntu by uninstalling dotnet sdk for good and following this article:

https://docs.microsoft.com/pt-br/dotnet/core/install/linux-ubuntu#2004-

After a clean installation, omnisharp works fine and finally i could debug XUnit tests!

Hope this helps anyone

ghost avatar May 12 '22 14:05 ghost

I'm using macOS. Pretty frustrating that there has been zero traction on this. I originally posted 1.5 months ago.

ahanusa avatar May 12 '22 20:05 ahanusa

I primarily do .NET development on macOS and exclusively in vscode so this affects me a lot. I just tried my workflow using a vscode dev container. This bug appears there as well. The dev container image is Debian based and is from Microsoft. Can't really uninstall and reinstall it there to fix it.

hannahchan avatar May 13 '22 13:05 hannahchan

Just a reminder that the culprit seems to be that the assemblies to debug are assumed to live in a ref directory, but no such directory exists.

@ahanusa If you do create the "ref" folder and move the dll-s and other stuff there, the the debugger works :)

agabor avatar May 16 '22 20:05 agabor

Yes, I have already mentioned that previously, however, I refuse to copy and paste binaries to that folder every time I do a build. I also don't feel like creating a script to do it for me as I have 20 projects in my solution.

ahanusa avatar May 16 '22 20:05 ahanusa

I am hitting this as well.

Doing some digging, it looks like we're trying to get the version from dotnet

https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Host/Services/DotNetCliService.cs#L133

and then reporting the error here:

https://github.com/OmniSharp/omnisharp-roslyn/blob/c6f1e848202d7fff16d52b81496b6980b436952d/src/OmniSharp.Abstractions/SemanticVersion.cs#L569-L584

This is with useModernNet set to true.

chamons avatar May 23 '22 21:05 chamons

I just tested this with the pre-release https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.25.0

No luck.

However, I was able to find a work around, I had a global.json in the test directory setting:

{
	"sdk": {
		"version": "6.0.301-rtm.22263.15"
	}
}

Renaming that file made it start working.

chamons avatar May 23 '22 21:05 chamons

@chamons Thanks for sharing your finding about you global.json.

If I have a project folder and add a global json requiring a version of the SDK that is not installed I see the following:

~/Source/format [main ≡ +0 ~1 -0 !]> dotnet --version
The command could not be loaded, possibly because:
  * You intended to execute a .NET application:
      The application '--version' does not exist.
  * You intended to execute a .NET SDK command:
      A compatible .NET SDK was not found.

Requested SDK version: 7.0.100-preview.5.22252.9
global.json file: /Users/joeyrobichaud/Source/format/global.json

Installed SDKs:
6.0.100 [/usr/local/share/dotnet/sdk]
6.0.101 [/usr/local/share/dotnet/sdk]
6.0.105 [/usr/local/share/dotnet/sdk]
6.0.200 [/usr/local/share/dotnet/sdk]
6.0.201 [/usr/local/share/dotnet/sdk]
6.0.202 [/usr/local/share/dotnet/sdk]
6.0.300 [/usr/local/share/dotnet/sdk]
6.0.301 [/usr/local/share/dotnet/sdk]
7.0.100-preview.2.22153.17 [/usr/local/share/dotnet/sdk]
7.0.100-preview.4.22252.9 [/usr/local/share/dotnet/sdk]

Install the [7.0.100-preview.5.22252.9] .NET SDK or update [/Users/joeyrobichaud/Source/format/global.json] to match an installed SDK.

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found

This, of course, will not parse as a semantic version and OmniSharp should add some special handling (or error message) for this case.

JoeRobich avatar May 23 '22 22:05 JoeRobich

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?

hannahchan avatar Jun 13 '22 11:06 hannahchan