Cannot debug unit tests - Failed to start debugger: "System.NullReferenceException: Object reference not set to an instance of an object
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 737
- Avg merge
- 18h 40m
- Merged PRs (30d)
- 31
Description
## Issue Description ##
The project I am working on is based on .net 5.0. It uses NUnit (3.12.0) and NUnit3TestAdapter (3.15.1) packages. This issue happens when I try to debug generic NUnit unit tests. It started recently and happens every time I try to click "Debug Test" link above generic unit test. Simple non-generic tests with and without parameters are working fine. I am using portable Visual Studio Code.
When I try to run such tests using "Run test" link, my tests won't run.



## Steps to Reproduce ##
1. Create simple test class.
2. Create generic unit test using NUnit (look at example screenshots).
3. Try to debug the test by clicking "Debug test"
## Expected Behavior ##
I should be able to debug the test
## Actual Behavior ##
I cannot debug the test
## Logs ##
### OmniSharp log ###
[fail]: OmniSharp.Stdio.Host
************ Response (4029.1222ms) ************
{
"Request_seq": 284,
"Command": "/v2/debugtest/getstartinfo",
"Running": true,
"Success": false,
"Message": "\"System.NullReferenceException: Object reference not set to an instance of an object\\n at OmniSharp.DotNetTest.VSTestManager.DebugGetStartInfoAsync (System.String[] methodNames, System.String runSettings, System.String testFrameworkName, System.String targetFrameworkVersion, System.Threading.CancellationToken cancellationToken) [0x00113] in <562a322676604b9ba06bd663e080b5d2>:0 \\n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <97ecc425804b41999f2fc93560b238f8>:0 \\n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <97ecc425804b41999f2fc93560b238f8>: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 <97ecc425804b41999f2fc93560b238f8>:0 \\n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000f3] in <08ec318a4de440fbb214735376fa2310>:0 \"",
"Body": null,
"Seq": 2316,
"Type": "response"
}
### C# log ###
No logs here.
### .NET Test Log ###
NUnit Adapter 3.15.1.0: Test discovery starting
NUnit Adapter 3.15.1.0: Test discovery complete
System.ArgumentException: The specified argument cannot be empty. (Parameter 'tests')
at Microsoft.VisualStudio.TestPlatform.ObjectModel.ValidateArg.NotNullOrEmpty[T](IEnumerable`1 arg, String parameterName)
at Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria..ctor(IEnumerable`1 tests, Int64 frequencyOfRunStatsChangeEvent, Boolean keepAlive, String testSettings, TimeSpan runStatsChangeEventTimeout, ITestHostLauncher testHostLauncher, TestSessionInfo testSessionInfo, Boolean debugEnabledForTestSession)
at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.RunTests(TestRunRequestPayload testRunRequestPayload, ITestHostLauncher testHostLauncher, ITestRunEventsRegistrar testRunEventsRegistrar, ProtocolConfig protocolConfig)
at Microsoft.VisualStudio.TestPlatform.Client.DesignMode.DesignModeClient.<>c__DisplayClass23_0.b__0()
## Environment information ##
**VSCode version**: 1.61.0-insider (1.60.2 too)
**C# Extension**: 1.23.15
Mono Information
OmniSharp using built-in mono
Dotnet Information
.NET SDK (reflecting any global.json):
Version: 5.0.203
Commit: 383637d63f
Runtime Environment:
OS Name: pop
OS Version: 21.04
OS Platform: Linux
RID: linux-x64
Base Path: [omitted]/5.0.203/
Host (useful for support):
Version: 5.0.6
Commit: 478b2f8c0e
.NET SDKs installed:
3.1.115 [omitted]
5.0.203 [omitted]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.15 [omitted]
Microsoft.AspNetCore.App 5.0.6 [omitted]
Microsoft.NETCore.App 3.1.15 [omitted]
Microsoft.NETCore.App 5.0.6 [omitted]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
|Extension|Author|Version|
|---|---|---|
|csharp|ms-dotnettools|1.23.15|
|vsc-community-material-theme|Equinusocio|1.4.4|;
Contributor guide
Assessment
This issue has not been assessed yet.