vscode-csharp: VSCode "Error processing launch options at field: program" popup when debugging an xunit test
Steps to Reproduce:
- Setup a project with xunit:
using System;
using System.Reflection;
using Xunit;
public class Fact2Attribute : FactAttribute
{
public Fact2Attribute()
{
Type thisType = GetType();
MethodInfo theMethod = thisType.GetMethod("MyOtherMethod");
var result = theMethod.Invoke(this, null);
}
public void MyOtherMethod(string singleParam){}
}
[Fact2]
public void ATestMethod()
{
Assert.True(false);
}
- Compile and using Code lens press
Debug Test
Expected behavior
It should fail before the test runs as we are invoking MyOtherMethod
without a param. An appropriate message should be shown.
Actual behavior
I get this window popup:
I don’t get any error messages in console. If I try and run test
rather than debug test
it seems to completely bypass the test so I end up with:
Total tests: 0. Passed: 0. Failed: 0. Skipped: 0
If I run dotnet test
I get the same result as run test
in code lens.
Versions:
dotnet 2.1.105 VS code 1.22.2 Omisharp 1.14.0 Ubuntu 16.04.4 LTS
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 17 (3 by maintainers)
Version 1.23.0 fixed it for me. Thanks!
Update
I confirm it worked for me with C# Extension**: 1.23.0 , instructions to download beta helped !
Seems like this should still be open - it’s still an issue in 1.22.1 anyway.
Repro from #3901:
Clone https://github.com/vchirikov/omnisharp_vscode_repro Open in VS Code Open UnitTest1.cs Click on Debug test codelens link on UnitTest1.Test1
OmniSharp trace logging for the Debug Test request:
Also experiencing this on windows using NUnit tests:
dotnet 2.2.103 VS code 1.35.0 Omnisharp: 1.19.1 Windows: 10.0.17134 Build 17134 NUnit3TestAdapter: 3.8.0 Microsoft.NET.Test.Sdk: 15.0.0 NUnit: 3.6.1