vstest icon indicating copy to clipboard operation
vstest copied to clipboard

"Run All" on Unit Test (.Net Core) throws exception

Open jinujoseph opened this issue 9 years ago • 4 comments

Repro steps

Create a project -> .Net Core -> Unit Test Project (.Net Core) Add few tests

public void TestMethod1()
       {
           Assert.IsFalse(true);
       }

Click Run All from the Test Explorer

Expected

Test executes with out any error / warning

Actual ------ Run test started ------ [xUnit.net 00:00:00.0437763] Exception discovering tests: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.Extensions.DependencyModel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.GetAvailableRunnerReporters(IEnumerable1 sources) at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.GetRunnerReporter(IEnumerable1 assemblyFileNames) at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.DiscoverTests[TVisitor](IRunSettings runSettings, IEnumerable1 sources, LoggerHelper logger, Func4 visitorFactory, Action4 visitComplete) [xUnit.net 00:00:00.1597105] Catastrophic failure: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.Extensions.DependencyModel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.GetAvailableRunnerReporters(IEnumerable1 sources) at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.GetRunnerReporter(IEnumerable1 assemblyFileNames) at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.RunTests(IRunContext runContext, IFrameworkHandle frameworkHandle, LoggerHelper logger, Func1 testCaseAccessor) ========== Run test finished: 3 run (0:00:02.7139478) ==========

jinujoseph avatar Feb 22 '17 21:02 jinujoseph

All cached test adapters are passing to testhost. If all projects in solution using same test framework, workaround: restart VS IDE.
Related to: https://github.com/Microsoft/vstest/issues/511

smadala avatar Feb 23 '17 06:02 smadala

Related #543?

codito avatar Feb 27 '17 01:02 codito

This is being tracked external to this repo here: https://developercommunity.visualstudio.com/content/problem/145929/run-all-on-unit-test-net-core-throws-exception.html

snkota avatar Nov 07 '17 12:11 snkota

Does not repro on latest VS2017.5 Microsoft.Net.Test.SDK 15.5.0, & latest Xunit / MStest Adapters

mayankbansal018 avatar Nov 21 '17 07:11 mayankbansal018