Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run certain nunit3 parameterized tests using "Run Test" and "Debug Test" codelens links #3722

Closed
mgayeski opened this issue Apr 13, 2020 · 3 comments · Fixed by OmniSharp/omnisharp-roslyn#1768
Labels

Comments

@mgayeski
Copy link

Issue Description

Parameterized NUnit generic tests won't run using CodeLens "Run Test" "Debug Test" hotlink, but the same tests are discovered and run correctly with "dotnet test" An "Error processing launch options at field: program" popup is shown.

Tried this in linux as well, same result.

Steps to Reproduce

  1. Clone repo at https://github.com/mgayeski/repro
  2. Run dotnet test, see four tests discovered and run
  3. Open project in vscode, try to run or debug all tests from each class using "Run All Tests"

Expected Behavior

Able to run and debug all tests using CodeLens hotlinks

Actual Behavior

Only tests from the UntypedTestFixture class can be run

Logs

OmniSharp log

Starting OmniSharp server at 4/13/2020, 4:23:51 PM
    Target: c:\Users\michael.gayeski\testdemo

OmniSharp server started.
    Path: C:\Users\michael.gayeski\.vscode\extensions\ms-dotnettools.csharp-1.21.16\.omnisharp\1.34.15\OmniSharp.exe
    PID: 37084

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 3 MSBuild instance(s)
            1: Visual Studio Professional 2017 15.9.28307.812 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin"
            2: Visual Studio Professional 2019 16.4.29806.167 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin"
            3: StandAlone 16.4 - "C:\Users\michael.gayeski\.vscode\extensions\ms-dotnettools.csharp-1.21.16\.omnisharp\1.34.15\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Professional 2019 16.4.29806.167 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\Users\michael.gayeski\testdemo'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in 'c:\Users\michael.gayeski\testdemo'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Users\michael.gayeski\testdemo\testdemo.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\Users\michael.gayeski\testdemo'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Users\michael.gayeski\testdemo\testdemo.csproj
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\Users\michael.gayeski\testdemo' on host 44692.
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file 'c:\Users\michael.gayeski\testdemo\testdemo.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project 'c:\Users\michael.gayeski\testdemo\testdemo.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: testdemo
[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.
[info]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session ended.
[info]: OmniSharp.DotNetTest.VSTestManager
        read: {"MessageType":"TestSession.Connected","Payload":null}
[info]: OmniSharp.DotNetTest.VSTestManager
        read: {"MessageType":"ProtocolVersion","Payload":1}
[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.
[info]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session ended.


C# log

Empty

Debug Log

-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}
-> (C) {"command":"launch","arguments":{"logging":{"engineLogging":false},"type":"coreclr","name":".NET Test Launch","request":"launch","debuggerEventsPipeName":"\\\\.\\pipe\\Microsoft.VSCode.CSharpExt.TestDebugEvents-35876","program":null,"args":null,"cwd":"C:\\Users\\michael.gayeski\\testdemo","internalConsoleOptions":"openOnSessionStart","__sessionId":"4060b49f-bb9f-45c7-8644-732fd7d2c122"},"type":"request","seq":2}
<- (E) {"seq":3,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/CommandFailed","data":{"VS.Diagnostics.Debugger.vsdbg.OSFamily":"Windows","VS.Diagnostics.Debugger.vsdbg.Version":"16.5.20117.1 commit:2a72eb2aadc6bc6a29b05ebcc642a2699007df45","VS.Diagnostics.Debugger.vsdbg.WindowsVersion":"10.0.18362","VS.Diagnostics.Debugger.vsdbg.Command":"Launch","VS.Diagnostics.Debugger.vsdbg.ErrorCode":1006,"VS.Diagnostics.Debugger.vsdbg.AdditionalData":"program","VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr"}}}
<- (R) {"seq":4,"type":"response","request_seq":2,"success":false,"command":"launch","message":"Error processing launch options at field: program"}

Environment information

VSCode version: 1.44.0
C# Extension: 1.21.16

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.101 Commit: b377529961

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\

Host (useful for support):
Version: 3.1.1
Commit: a1388f194c

.NET Core SDKs installed:
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.508 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

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

Visual Studio Code Extensions
Extension Author Version
azurecli ms-vscode 0.5.0
c-cpp-project-generator danielpinto8zz6 1.2.1
code-settings-sync Shan 3.4.3
code-spell-checker streetsidesoftware 1.8.0
csharp ms-dotnettools 1.21.16
docomment k--kato 0.1.9
dotnet-test-explorer formulahendry 0.7.1
gitlens eamodio 10.2.1
Go ms-vscode 0.13.1
intellij-idea-keybindings k--kato 0.2.38
markdown-all-in-one yzhang 2.8.0
markdown-table-prettify darkriszty 2.4.0
openapi-designer philosowaffle 0.3.0
plantuml jebbs 2.13.6
powershell ms-vscode 2020.3.0
remote-containers ms-vscode-remote 0.112.0
remote-wsl ms-vscode-remote 0.44.2
terraform mauve 1.4.0
vscode-docker ms-azuretools 1.0.0
vscode-table-formatter shuworks 1.2.1
@vietvoquoc
Copy link

I have the same issue like this - asking at this. Is there any update on this issue?

@mgayeski
Copy link
Author

Thanks for the quick fix!

@mpelley
Copy link

mpelley commented Mar 31, 2022

I am seeing the same issue, two years after it was fixed. The following C# file correctly runs the tests using "dotnet test", but generates a "Failed to start debugger: "System.NullReferenceException: Object reference not set to an instance of an object.\r\n at OmniSharp.DotNetTest.VSTestManager...." exception when I click the "debug all tests" link.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants