Whenever I try to run any of the test from my test suite in Visual Studio 2012 I get
Test Failed - [test method name]
Message: Failed to set up the execution context to run the test
and my test is not even started (i.e. the source of the test failure is pointing at the beginning of the test method:
here--> TEST_METHOD([test method name])
{
}
What does this message mean, what could be the cause for it to appear and what should I do for my test to run correctly?
After some more research I realized that I overlooked the fact that I changed the 'Output Directory' of the project containing the methods under test (which was a .dll) and was not in the same folder as my test project library, hence giving me the message:
Message: Failed to set up the execution context to run the test
So the problem was solved by making sure that the .dll containing the methods under test was in the same folder as my test project library so that at run-time my test project could find the .dll.
I had the same issue and the previously mentioned suggestions did not fix it for me. My project uses some third party libraries and the paths to these are set up correctly in the compiler and linker settings of my VS project.
It turns out that the VS test engine was unable to find the libraries, so I added the paths to these libraries to the PATH environment variable. This fixed the issue for me.
Tip: Try running the unit tests from the command line using VSTest.Console.exe. The error messages helped me debug my issue more easily.
For those searching for other answers, this turned out to be a problem finding all the DLLs needed. I followed the advice above getting both the test dll and the dll to be test in the same location but still got this error.
My test DLL, out of its native environment, couldn't find its children DLL. You can figure out what is missing by running depends.exe . Adding the locations to these other DLL's to my path resolved the problem and everything now works.
I was getting this error, and it was because I was using a debug DLL, and did not have debug c++ runtimes where they could be found. I copied the debug c++ runtimes into the same directory and the issue was resolved.
I had this error after including a third party dll (OpenCV) in my project. Adding the dll to path or dropping it in the system32 directory does work, but I have a better solution.
The test is run from a directory called AppX. In my case it is here:
.......OneDrive\Documents\Visual Studio\Projects\TutorialOcr\x64\Debug\OcrTesting\AppX
I just dropped the dll in there and the test worked!
The .dll created for the tests is run from the folder where it is built to. In my case "x64\UnitTests\Tests.dll". The rest of my application is in "x64\Debug\App.exe" and "x64\Release\App.exe".
My application depends on external dlls which are located in the root folder of the project, which is also the "Working Directory" specified for debug launch.
But the Test Explorer test launcher ignores that setting and always launches Tests.dll with working directory "x64\UnitTests", and then fails to find the dlls I depend on. Adding SetCurrentDirectory("..\\.."); in, say, the test class constructor does not fix the problem, because the dll cannot even be loaded into memory if the static dependencies are not found.
I solved it by just setting the "Output Directory" to "$(SolutionDir)" for the UnitTests configuration. This causes the Tests.dll to be created in the root folder.
I was also getting this error only in the Release configuration, because I accidentally used a debug lib as one of the library dependencies of my test project. ( same problem as bmann's post )
To find which library was causing the problem, I commented out all the test code and its includes, added one empty test, and removed my dependency libraies one by one until the test worked.
Related
I have read many issues regarding and followed each one but nothing seems to work.
I am trying to include the rdkafka library into my project, but every time I run the application I am getting
The program can't start because librdkafka.dll is missing from your computer.
I can clearly see that librdkafka.dll as well as librdkafka.lib exist in the same directory. I have added the include files to the project, and I have also added the librdkafka.lib to the additional directories in the Linker section. The project builds fine but it throws that error at runtime.
Does anyone know how I can solve this issue?
When in Visual Studio by default it is searching for dlls in the project directory and running the application on its own will try to find the dlls in the current working directory. Moving the dlls to this location seems to solve the issue.
I have a solution with multiple C# projects included, and a single C++ project.
The C++ project is a .NET Framework bootstrapper that should produce a native executable file. I first built the project as a single project solution, however i'm now trying to migrate it into a master solution.
In order to migrate it, I added a new project called Setup to my existing solution called Master. I then added each header, source and resource by adding new files and copy-pasting the content.
I also changed the output directory to $(Configuration)\ so that it doesn't put the Debug and Release folders in the root folder of the solution.
Now, when I attempt to build the project, it says Rebuild All Succeeded, however when i try to debug it i get the following error
Unable to start the program ~ The system cannot find the file specified
Image of error shown when attempting to debug (F5)
If i navigate to the output directories, they are empty.
This is my first attempt at a C++ project, have i made a schoolboy error?
Does anyone know how I can get this working?
I found the answer. It was indeed a schoolboy error.
I was targeting AnyCPU, whereas i should have been targeting x86.
Now that i'm targeting the correct architecture, the project builds as expected.
I am trying to deploy a simple C++ Open GL graphics program using InstallShield Limited Edition. I have managed to create an example installer, but my main program crashes on start up. My debugger gave me a pretty vague error
error_text 0x00cceb28 L"R6010\r\n- abort() has been called\r\n" const wchar_t * const
in file crt0msg.c
I have run dependency walker and it says that I am missing the following:
API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL
EXT-MS-WIN-NTUSER-UICONTEXT-EXT-L1-1-0.DLL
IESHIMS.DLL
As far as I know these are windows systems .dlls? I cant seems to run the profiler as dependency walker always hangs and crashes. I have tested my example project and it seems to be missing the same .dll's but runs fine.
The project has 2 external libraries in the dependencies (Never built one with external libraries before). I have also included a folder with text files next to the Primary output as is the structure in the release folder of VS2013. The assets folder etc seem to be compiling.
I have never deployed a project before, could anyone let me know what might be the cause?
The error was due to the assets folder not linking correctly. I am going to try a different installer however.
I included vld.h, vld.lib and vld_x86.dll on my Win32 project with visual studio 2010. It builds properly but when I execute, it crashes with this message:
"The application was unable to start correctly (0xc0150002). Click OK to close the application."
I run it with Dependency Walker but it shows side by side error as follows:
Error: The Side-by-Side configuration information for "D:\project\..\debug\VLD_X86.DLL" contains errors. The application has failed to start because its side-by-side configuration is incorrect.)
I have tried various ways including tinkering around with the manifest as suggested here:
https://vld.codeplex.com/discussions/360243
It only runs properly if I commented the following line on vld.h
// Force a symbolic reference to the global VisualLeakDetector class object from
// the DLL. This ensures that the DLL is loaded and linked with the program,
// even if no code otherwise imports any of the DLL's exports.
//#pragma comment(linker, "/include:__imp_?g_vld##3VVisualLeakDetector##A")
However, if I commented out that line, the vld doesn't output anything at all (just like no vld integration)
Anyone having this problem before? Any suggestions will be appreciated, thanks in advance!
I had this problem too, you need to add all these files to the same directory as your vld_x86.dll/vl_x64.dll:
Microsoft.DTfW.DHL.manifest
dbghelp.dll
Which came from the Win32/Win64 bin folder from Visual Leak Detector. Found this from: https://vld.codeplex.com/wikipage?title=Building%20Visual%20Leak%20Detector%20from%20Source
I had this problem (this error message), too. In my case the vld_x86.dll, most likely in another than the expected version, was preinstalled and registered by some other software. (everybody likes VLD, it seems) Thus, it was loaded instead of the vld_x86.dll in the path VLD was built to. Unregistering the foreign DLL solved the problem.
Hence, you might want to check the output for loading of DLLs from exotic paths.
Other might still get into the issue;
A potential fix is to install VLD version 2.5.1, can be downloaded from github: https://github.com/KindDragon/vld/releases/tag/v2.5.1
It brings the fix explained above, it includes dbghelp.dll
I got such error when I tried to run a project just after installing vld. A solution for me was re-login. Because vld installer adds new paths to PATH and VS doesn't see them without re-login. Otherwise you can use a solution with copying files dbghelp.dll and .manifest.
If you are using Visual Studio
The simplest fix if you have not been messing with your project properties in the include, linker sections is to make sure that you did not manually add VLD. Instead clear the includes you made in here and save your project.
Close it then install the latest VLD and it will automatically create the includes parent inheritance for your Visual Studio projects including environment paths as well.
I've recently downloaded Assimp and I've run into some troubles.
I've linked the libraries and I can get the program to compile and it runs fine in Release mode; however, the Debug .exe hits me with this error:
The application was unable to start correctly (0xc0150002). Click OK to close the application.
Some more details:
I'm using VS2010 with Target Machine set to x86.
I am using the 32bit debug dll (Assimp32d.dll) that was provided, and I've tried setting runtime libraries to /MT, /MTd, /MD, and /MDd with no luck.
I read from other similar threads that I should run Dependency Walker on the .exe, but I'm not sure what the output means. I'll paste it here if this helps you guys.
Error: The Side-by-Side configuration information for "c:\users\-----\documents\visual studio 2010\projects\AssimpTest\debug\ASSIMP32D.DLL" contains errors. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail (14001).
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Rather than rebuilding the libraries, I downloaded a different set of libraries (it was the SDK installer) and the debug dll's from that are working perfectly.
Just in case anyone has the same problem with the same software, this was the exact name of the installer that worked for me: assimp-sdk-3.0-setup.exe
I ran into the same problem when trying to run a 64-bit project in Debug mode when using Assimp 3.0.
What I did was go to assimp/workspaces/vc9, open assimp.sln in Visual Studio 10, convert the project, then rebuild the 32 and 64-bit dll.
Mind you, you've got to install boost for that as well, and edit the project properties so it points to the boost directory for includes.
There's probably a way to do it using CMake as well, but I found the whole process too cumbersome to bother with in the first place.
My solution was just to link the debug build to the release .dll files. No more issues, and I wasn't that interested in debugging the Assimp library anyway!
I faced the same issue, later on I downloaded the "assimp-sdk-3.0-setup.exe" file & installed it as a standard windows application.
I pointed Visual Studio Solution Include & Lib directories to respective folders from newly installed location, copied DLL to my application location. The problem was resolved. Hope this helps someone.
Cheers.