Xunit cannot detect tests after upgrading to v2

After switching to xunit2 and after the migration guide ( http://xunit.imtqy.com/docs/test-migration.html ), I get the following error when testing tests in my projects:

------ Discover test started ------ [xUnit.net 00:00:00.0701819] Exception discovering tests from MyLibrary.Tests.dll: System.MissingMethodException: Constructor on type 'Xunit.Sdk.TestFrameworkProxy' not found. at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes) at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes) at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes) at Xunit.RemoteAppDomainManager.CreateObject[TObject](String assemblyName, String typeName, Object[] args) at Xunit.Xunit2Discoverer..ctor(ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder) at Xunit.XunitFrontController.CreateInnerController() at Xunit.XunitFrontController.get_InnerController() at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.DiscoverTests[TVisitor](IEnumerable`1 sources, IMessageLogger logger, Func`3 visitorFactory, Action`3 visitComplete, Stopwatch stopwatch) ========== Discover test finished: 0 found (0:00:00.2454142) ==========

I have no experience debugging test terminals or xunit, so I don't know where to look. I hope someone has run into the problem earlier and can give a quick answer, but my google-fu shows nothing.

I do not know what information would be useful to track this problem, so I will add that people ask for them.

+4
source share
2 answers

From the documentation of the test runner: If you're having problems discovering or running tests, you may be a victim of a corrupted runner cache inside Visual Studio.

Removing %TEMP%\VisualStudioTestExplorerExtensionsseems like a problem.

Ref.: http://xunit.imtqy.com/docs/running-tests-in-vs.html

+10

, Xunit Xunit.Runner.VisualStudio nuget

0

All Articles