Search code examples
visual-studiolive-unit-tests

Every test in project says "Excluded from Live Unit Testing"?


I have the test adapter & framework packages added per the docs https://learn.microsoft.com/en-us/visualstudio/test/live-unit-testing-faq?view=vs-2017.

I see the "beaker" symbol\icon beside each test, but hovering says it's Excluded from live unit testing.

Tests all run fine MANUALLY, and I've tried right-clicking and telling it to include, but does nothing. I have no code in here manually excluding anything...

.net 4.7.1 project

EDIT

There is an error

[10:03:48.205 Error] [TestRunner 1] An exception occurred while invoking executor 'executor://mstestadapter/v2': Could not load file or assembly 'System.Xml.ReaderWriter, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Could not load file or assembly 'System.Xml.ReaderWriter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

This is a 4.7.1 project testing another 4.7.1 project which is EFCore based.


Solution

  • I was getting a similar the same error, in out output window in the "Live Unit Testing" category, I found the following error:

    FatalError - System.AggregateException: One or more errors occurred. ---> System.Exception: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
    

    I downloaded the latest version of that nuget package and it did not help, I basically had to force the 4.0.0.0 version in the config file which doesn't make much sense due to the fact that the actual version of the dll is 4.1.2.0. Any way, after that I stopped and started Live Unit Testing and now it works without a problem. Hope this helps.

    <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.0.0.0" />