Running MsTest throws "Load" method does not have an implementation - visual-studio-2010

After upgrading from TFS 2008 to 2010 and running crazy having the build to properly run unit tests.
When running unit tests from build or command line I get the error:
Loading C:\Builds\159....\Binaries\Mixed Platforms\Release....UnitTest.dll...
C:\Builds\159....\Binaries\Mixed Platforms\Release.....UnitTest.dll
Method 'Load' in type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.TestMethod' from assembly 'Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,
Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' does not have an implementation.
Does any anyone have any clue, other then an repair of the VS?

The error was caused by some assembly redirect in unit test's app.config, which was redirecting System.Xml and one other assembly to 2.0 framework.
Probable mstest is replacing the original exception with a new one....

Related

Passing visual studio webtests fail in test explorer

I have a web performance and load testing project which executes as epected when I open the test definition and hit run however fails when i run through test explorer.
I have narrowed this down to only tests which reference another project in the solution (utilities project for custom validators).
when running tests via test explorer it errors with Request failed: Could not load file or assembly 'PerformanceTestingUtilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. However works fine if I open the test and hit run.
What could be causing this to happen? I get no errors on build and nothing in the output.

.NET Core 2.0 dependency issue

I have a library used in various project and made with .net core 2.0; the library is called 'Coconut'; the test is done on Windows.
When I try to build a simple test project to test some functionalities, the test code will not run.
The test is very simple:
but when I run it:
And the output is:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Could not load file or assembly 'Coconut, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
and the console shows the same problem:
What I don't understand is that the DLL that is not found is built in the same solution and everything was built through Visual Studio's tooling.
We can clearly see the dll in the same folder.
Edit:
When checking with procmon, there is not a single operation trying to load 'coconut.dll'; that string is completely absent from the log.

Can't find assembly - System.Reactive.Debugger

I have installed visual studio 2010 express and then Reactive Extensions 2.0. When I start my app in debug mode, part of code where reactive extensions is used following exception is thrown:
The assembly with display name 'System.Reactive.Debugger' failed to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure was:
System.IO.FileNotFoundException: Could not load file or assembly
'System.Reactive.Debugger, Version=2.0.20823.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies
The problem is that nowhere I can find this dll - System.Reactive.Debugger.

MSTest on x64 C++/CLI

I got a problem using MSTest on x64: The test project depends on a couple of C++/CLI assemblies, and fails to load for some reason. In Visual Studio, I get (stripped down):
Error loading D:\xxx\Xxx.Test.dll: Unable to load the test container 'D:\xxx\Xxx.Test.dll' or one of its dependencies. Error details: System.BadImageFormatException: Could not load file or assembly 'Common.Geometry.Native, Version=1.1.4574.22395, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Running MSTest manually in a command prompt, I get:
Unable to load the test container 'D:\xxx\Xxx.Test.dll' or one of its dependencies. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'Common.Geometry.Native, Version=1.1.4574.22395, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Details worth mentioning:
The test project itself is compiled using 'Any Cpu'.
I use a x64 specific testrunconfig
Dependency walker shows no missing native dependencies in the C++/CLI assembly (Common.Geometry.Native)
Even more interesting, there is another test project in the same solution using the same C++/CLI assembly (Common.Geometry.Native), and it runs without any problems.
I have also verified that there are no 32bit assemblies/dlls interfering.
Any suggestions is welcome !
I'd initially thought that microsoft didn't add a 64-bit capable test runner for MSTest until 2012... As it turns out, VS2010 is capable of this.
What I'd check then is if your native dll has any other native dependencies.
MSTest has a "mis-feature" where, before running your tests, it creates a temp directory, usually something like PC-NAME WORKSPACE_NAME 1782368124\Out, and it copies your code into that directory. For .NET assemblies, it can figure out the dependencies and is able to copy them, but for native code it does not appear to do this.
I've solved this in the past by adding the directory containing any other native dependencies to the PATH environment variable for my user account (remember if you do this to restart visual studio as it won't notice)

MSTest and TFS Build 2010

I am having some issues trying to get my automated builds to compile projects that reference Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll. For some reason the project fails to compile complaining that
Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk.
I have installed VS2010 Premium on my build server but this does not seem to have resolved the issue. Am I missing something here?
Your version Version=9.0.0.0 is part of VS2008, so it makes sense that it can't be found on your build server even though you 've installed VS2010.Consider changing your project-ref into Version=10.0.0.0 which corresponds to your current VS-version.

Resources