Cannot run C# tests
Environment data
.NET Core SDK: 2.1.401 OS Name: ubuntu 16.04 VS Code version: 1.27.1 C# Extension version: 1.16.1
Steps to reproduce
- Open folder in VSCode with C# netcore solution.
- Wait for OmniSharp to load completely.
- Open xUnit test file
Expected behavior:
Links Run|Debug should appear above each test method
Actual behavior:
Links Run|Debug don't appear.
It worked in previous version. Also it works on small projects.
The OmniSharp log is ok - no error messages.
At the same time the OmniSharp icon display that it has errors:

Also there are errors in Window log. I have also attached the VSCode Window log with errors: WindowLog.txt
And OmniSharp log: OmniSharpLog.txt
@denisvlah The red error flame is not because of omnisharp process crashing. It is because of a typical mono behavior and we have already fixed that in master: https://github.com/OmniSharp/omnisharp-vscode/pull/2540.
From your omnisharp log I don't see any error being printed. Since you are saying that it works on small projects, can you try "omnisharp.projectLoadTimeout" to a higher value and then "Ctrl+Shift+P --> Restart Omnisharp"?
@denisvlah Any updates here ?
The OmniSharp doesn't timeout. Intelicence and code navigation and code suggestions works perfect, it just not show links to run tests. Also I have tried it on Windows with the same solution and it worked. Also a few words about solution - it has 2 .csproj files in the same folder. They are related to different solutions. One project is for netcore and the second one is for full framework. On the Windows where I can run tests it display links but fails to run. It complaints that folder has 2 project files. If there is only 1 project file it works fine.
Update: I have elaborated a solution with project files that can reproduce the issue. Check the attached file. Steps to reproduce: 1 ) Open attached folder. 2) Wait Until OmniSharp is started and loaded. 3) Notice that it displays links "Run Test | Debug Test" correctly in the file CalculatorTest.cs 4) You should also notice a suggestion from C# extension to restore dependencies. Click "Restore" 5) Close the visual studio code 6) Open folder in visual studio code 7) Wait until OmniSharp is started and loaded. 8) Open file CalculatorTest.cs and observe that there is no links "Run Test | Debug Test". It is supposed to be displayed.
Also notice that the custom TestAttribute is inherited from Xunit.Fact and it is used to mark test method in CalculatorTest class. If you use standard Fact attribute it works fine. It worked fine in the previous version.
In my prod environment I have ported hundreds Nunit tests to Xunit testing framework using such kind of hack. OmniSharp_UnitTest_with_links_bug.zip
@denisvlah I can totally reproduce the problem.
More information:
In my developer console, I see that there was an error.

We will get it resolved as soon as possible. Thank you for your patience.

There is an argument exception in the omnisharp process, due to which the codelens is not appearing.
On investigating further, the line here is throwing the exception: https://github.com/OmniSharp/omnisharp-roslyn/blob/fe68d63b16fb44b2e647f538ffd8b1ec95fabb0e/src/OmniSharp.Roslyn.CSharp/Services/Structure/CodeStructureService.cs#L365
Because it is adding two values for the same key -"testFramework" - xunit and nunit
When I changed the namespace "NUnit.Framework" to "abc.Framework", everything works fine.
Closing this issue as it is very specific to the project I am working on and a better way to go is to refactor all tests to use NUnit3 with standard [Test] without additional hacks.