vscode-dotnet-test-explorer icon indicating copy to clipboard operation
vscode-dotnet-test-explorer copied to clipboard

C#: Could not find test (no symbols found) in .Net Core 3.1

Open Vijay-Nirmal opened this issue 5 years ago • 10 comments

When clicking on a test in .Net Test Explorer, it shows

C#: Could not find test (no symbols found)

If I try to rerun the test, its continuously loading instead of rerunning

image

This issue is only happens in C# .Net Core 3.1. Everything works properly in C# .Net Core 2.2

Related Issue but it is for F#: https://github.com/formulahendry/vscode-dotnet-test-explorer/issues/228

Dotnet SDK Version: 3.1.100

Unit test framework and relevants versions of that:

Package Version
Microsoft.NET.Test.Sdk 6.4.0
Moq 4.13.1
MSTest.TestAdapter 2.0.0
MSTest.TestFramework 2.0.0

Vijay-Nirmal avatar Jan 06 '20 05:01 Vijay-Nirmal

Also having it happen. Here's the logs:

Could not find test (no symbols found) Test run for XXX.Api.Tests.IntegrationTests.V1.Content.XXXControllerTests.Create_Success, expecting 1 test results file(s) in total Executing dotnet build in d:/Repos/XXX/Api/Api/IntegrationTests Executing dotnet test --no-build --logger "trx;LogFileName=C:\Users\XXX\AppData\Local\Temp\test-explorer-sJg6gd\0.trx" --filter "FullyQualifiedName=XXX.Api.Tests.IntegrationTests.V1.Content.AssessmentControllerTests.Create_Success" in d:/Repos/XXX/Api/Api/IntegrationTests Process 4636 started Waiting for debugger to attach

JohnGalt1717 avatar Apr 27 '20 13:04 JohnGalt1717

I am also having this issue.

The issue seems to stem from having tests in an abstract class for me. My setup is:

PackageVersion
xunit2.4.1
xunit.runner.visualstudio2.4.1
Microsoft.Net.Test.SDK16.6.1

Once I changed the abstract class to a normal class, Test Explorer picked up on the tests and was able to navigate to them without the "no symbols found" warning.

For me, this isn't a big issue, at the moment. However, if my team and I decide to expand these tests to span multiple database contexts (see this tutorial with this sample code) this could be an issue.

ska737 avatar Jun 08 '20 15:06 ska737

@ska737 Ah interesting, thanks for providing that information.

It appears that tests defined in abstract classes are not discovered by the underlying test framework, which from a class perspective makes sense. Once you have something inheriting your abstract class those tests should show up on that inheriting class.

stefanforsberg avatar Jun 08 '20 16:06 stefanforsberg

Do we have any updates to fix or workaround?

tungphuong avatar Aug 20 '21 06:08 tungphuong

Any news about this? I'm having this problem too, but I do not use abstract class....

PauloDanielCarneiro avatar Sep 08 '21 14:09 PauloDanielCarneiro

Me too...

mika76 avatar Oct 25 '21 09:10 mika76

Any workaround to this? .NET Test explorer sometimes runs a test fine, but "Go to test" fails with "no symbols found" error. It discovers them (so it knows they exist and where), so it'd make sense it can also go there.

Some tests are discovered, but trying to run them leads to "no symbols found". Next to impossible to use the .NET Test Explorer, unfortunately.

abelbraaksma avatar Oct 06 '22 12:10 abelbraaksma

having the same issue as @abelbraaksma, it runs the tests but if i want to go to them or debug them with the .Net Test explorer it leas to "no symbols found"

ecliPze507 avatar Apr 20 '23 15:04 ecliPze507

Same problem here in 2023... Have you guys found a solution ?

NicoAtScopely avatar Aug 07 '23 16:08 NicoAtScopely

Same problem

colin-higgins avatar Nov 16 '23 15:11 colin-higgins