question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"No test is available" with /logger:trx but everything works with /logger:console

See original GitHub issue

Please excuse the interesting PowerShell command. It’s based on the command that Azure Pipelines VSTest task builds. I’m trying to track down the difference between an Azure Pipelines build that skips all tests and a build in a different project that actually runs the tests. It comes down to what looks like a VSTest console bug. I can repro locally using the open-source project I’m looking at. If you need it, I can spend the time to boil down the minimal files needed to demonstrate.

If you change /Logger:trx to /Logger:console OR you remove the /TestAdapterPath parameter, tests begin to be discovered and everything works properly.

C:\Users\Joseph\Source\Repos\PropertyChangedAnalyzers [(b740437...)]> &"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" "PropertyChangedAnalyzers.Test\bin\Release\net472\PropertyChangedAnalyzers.Test.dll" /Logger:"trx" /TestAdapterPath:"."
Microsoft (R) Test Execution Command Line Tool Version 16.3.0-preview-20190715-02
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
No test is available in C:\Users\Joseph\Source\Repos\PropertyChangedAnalyzers\PropertyChangedAnalyzers.Test\bin\Release\net472\PropertyChangedAnalyzers.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.      Test run in progress.Results File: C:\Users\Joseph\Source\Repos\PropertyChangedAnalyzers\TestResults\Joseph_TALIESIN_2019-11-06_17_11_12.trx

Diagnostic logs

verbose_diagnostic_log.txt

It looks like the diagnostic log is full of 283 repetitions of vstest.console.exe failing to load System.Runtime.dll. Why would these failures go away if you change /Logger:trx to /Logger:console or if you remove the /TestAdapterPath parameter?

TpTrace Warning: 0 : 22240, 4, 2019/11/06, 17:16:05.318, 3276125106496, vstest.console.exe, TestPluginDiscoverer: Failed to get types from assembly 'NUnit3.TestAdapter, Version=3.15.1.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac'.  Skipping test extension scan for this assembly.  Error: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginDiscoverer.GetTestExtensionsFromAssembly[TPluginInfo,TExtension](Assembly assembly, Dictionary`2 pluginInfos)
TpTrace Warning: 0 : 22240, 4, 2019/11/06, 17:16:05.318, 3276125107286, vstest.console.exe, LoaderExceptions: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.CurrentDomainAssemblyResolve(Object sender, AssemblyResolveEventArgs args)
   at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.AssemblyResolverEvent(Object sender, Object eventArgs)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nohwndcommented, Mar 4, 2021

There is an option to fail the build on no tests https://github.com/microsoft/vstest/issues/2707

0reactions
AndirNotescommented, May 1, 2023

I’ve also got into this issue with migrating to 17.5.0 Microsoft.TestPlatform in our Azure DevOps builds and VSTest@2 task. Any workarounds available? @singhsarab? @Evangelink Could you please explain why it’s by design? What that mean?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does dotnet vstest return "No test is available in" when ...
I have a built dll file for a test project in .net framework 4.6. The test runs fine when I do vstest.console.exe test.dll...
Read more >
dotnet test command - .NET CLI
The dotnet test command builds the solution and runs a test host application for each test project in the solution.
Read more >
Untitled
NET Core v2 task Microsoft Learn The Easiest Way to Generate and Publish . ... "No test is available" with /logger:trx but everything...
Read more >
Vstest.console.exe always adds Console logger in update ...
I'm using /logger:Trx to send the output to an XML trx file, so I don't want or need the output going to the...
Read more >
LoFuUnit
Any subsequent test functions in the test method will not be invoked. Make sure that all test methods actually invoke Assert or AssertAsync...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found