Open Steinblock opened 6 years ago
I will check this at the weekend. Until that I suggest you use MSTest V2 1.2.1 as latest AxoCover, which should resolve the issue. If you are not at the latest plese update.
You may refer to this file to see the current versions of the test frameworks: https://github.com/axodox/AxoCover/blob/master/AxoCover.Dependencies/packages.config
I'm on version 1.3.0-beta2
because of in assembly parallel test execution.
After diging around in your code I found a workaround:
public MsTest2Adapter(IEditorContext editorContext)
{
_assemblyPath = Path.Combine(AxoCoverPackage.PackageRoot, @"MSTestAdapter\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll");
_redirectedAssemblies = Directory.GetFiles(Path.GetDirectoryName(_assemblyPath), "*.dll");
}
Redirected assemblies are evaluated at runtime by scanning C:\Users\...\AppData\Local\Microsoft\VisualStudio\15.0_60087b23\Extensions\...\MSTestAdapter
.
I copied the satellite assemblies to this location before but it turns out I have to restart visual studio for this to take effect.
Maybe in a future release you could determine the assemblies to redirect by using
var _assembly = Assembly.GetAssembly("Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll");
var _assemblyPath = _assembly.Location;
var _redirectedAssemblies = Directory.GetFiles(Path.GetDirectoryName(_assemblyPath), "*.dll", SearchOption.AllDirectories);`
or by using
Assembly.GetAssembly("Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll").GetReferencedAssembylies()
(while excluding framework assemblies.
It turns out the real exception was just
SerializableException: Die Datei oder Assembly "Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abh„ngigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
bei Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Deployment.AssemblyLoadWorker.GetTargetFrameworkVersionStringFromPath(String path)
bei Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Deployment.AssemblyLoadWorker.GetTargetFrameworkVersionStringFromPath(String path)
bei Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Utilities.AppDomainUtilities.GetTargetFrameworkVersionString(String testSourcePath)
But this was just logged and the tests passed.
Anyway, I copied the file Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
from <extensionpath>\TestPlatform
to <extensionpath>\MSTestAdapter
and now the stacktrace is gone.
FYI, this is the content in my <extensionpath>\MSTestAdapter
folder now.
02.05.2018 11:36 114.528 Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll
15.01.2018 02:05 31.760 Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll
02.05.2018 11:36 122.264 Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll
02.05.2018 11:36 25.024 Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll
15.01.2018 02:05 25.160 Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll
02.05.2018 11:36 135.528 Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
02.05.2018 11:36 69.968 Microsoft.VisualStudio.TestPlatform.TestFramework.dll
02.05.2018 11:36 39.808 Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
15.01.2018 02:05 27.640 Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll
I have an odd problem that I can't really reproduce in a sample app.
If I run / debug / cover all tests or even multiple tests at once, every test fails with a
FileNotFoundException
I tracked down the issue to the following conditions:
DeploymentItem
attribute.This is strange, all tests fail, even if they don't have an
DeploymentItem
itself.DeploymentItem
attribute and all tests run (the ones relying on the DeploymentItems fail, but without the FileNotFoundException, others run fine)Assert.IsTrue(true)
soMyApp
won't be used, and it will pass.DepoymentItem
individually passes.I even added every indirect dependency from myapp, but without a result.
I am using AxoCover with MsTest V2 (Version
1.3.0-beta2
, Adapter ModeStandard
andRedirect dlls of test framework assemblies
enabled).Anyway, I believe the
FileNotFoundException
has something to do with theRedirect dlls of test framework assemblies
not redirecting the satellite asemblies and the exception is thrown while generating a usefull error message:Could you please extend the file redirection feature for
Here is the full stack trace