Assembly loading failure when using the CLI library - c++

For some reason I can not launch my 64-bit application. I receive an error:
14:17:41:587 Error: The type initializer for 'Va.MBClient.Program' threw an
exception.
Unhandled Exception: System.TypeInitializationException: The type initializer fo
r 'Va.MBClient.Program' threw an exception. ---> System.IO.FileNotFoundExce
ption: Could not load file or assembly 'CGateCliAdapter.dll' or one of its depen
dencies. The specified module could not be found.
at Va.MBClient.Program..cctor()
--- End of inner exception stack trace ---
at Va.MBClient.Program.Main(String[] args) in c:\Oleg\projects\Va.M
BClient\Va.MBClient\Program.cs:line 87
Somehow this is connected with my CLI DLL file, because when I outcomment the line private static CGateCliAdapterMain cliAdapter = new CGateCliAdapterMain();, which refer to the CLI library, I can launch the application.
I do see this in Visual Studio:
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()
[Native to Managed Transition]
I've tried to use fuslogvw to catch a binding failure, but it can't catch it for some reason! So now I don't know how to troubleshoot the problem.
I've used Dependency Walker and have found that the following files are missing:
MSVCR110.DLL
GPSVC.DLL
IESHIMS.DLL
MF.DLL
MFPLAT.DLL
MFREADWRITE.DLL
WLANAPI.DLL
I've tried to copy wlanapi.dll directly to a folder with the application and that helped (the DLL file disappeared from the missing list), but why are DLL files not visible when I've installed Visual C++ Redistributable for Visual Studio 2012? I've tried to reinstall and repair the installation.
Also, I can't find the DLL files MSVCR110.DLL and MSVCP110.DLL.
I don't know why. I've tried to reinstall Visual C++ Redistributable for Visual Studio 2012 many times.
Update:
Now again I can not run my program for some reason! After one day, Dependency Walker again claims that DLL files are missing. However, I do have "Visual C++ Redistributable for Visual Studio 2012".

I found a solution. Visual C++ Redistributable for Visual Studio 2012 needs to be installed.

Related

Visual C++ to Visual Studio 2019 - A Dependent DLL was not found

I'm in the process of migrating some legacy MFC applications that were, and are still supported by Visual Studio 2008.
The automated migration that's packaged in with Visual Studio 2019 allows the program and supporting libraries to successfully build; however, at execution this error appeared:
The code execution cannot proceed because MSCVR90D.dll was not found. Reinstalling the program may fix this problem.
After further research, this appears to be a Visual Studio debug DLL. After finding the DLL and dropping it into my debug folder, I receive a brand new error:
Debug Error!
R6034
An application has made an attempt to load the C runtime library without using a manifest.
I've followed the various StackOverflow and MSDN troubleshooting steps that touch on this issue, mostly changing settings within the Linker and Manifest settings, but to no avail.
Anyone have any ideas? Be it with resolving the DLL issue, or the manifest issue that follows its explicit inclusion in the project.

Visual Studio 2017 C++ built executable refuses to launch on another PC

I have a C++ project in Visual Studio 2017, which I built an executable file from, using the answer from this question found on MSDN , the .exe was built successfully, but when I copy this file to another PC and try to launch it, it returns me an error message, which says that launching of this app is impossible, because libcurl.dll is absent, what should be done, for avoiding this problem ?
Here's the preset which I'm using for .exe creation
P.S.
If it is of any help, when I created the project, I've chosen Empty Visual C++ Project.

ImageWatch in Visual Studio 2013 : exception has been thrown by the target of an invocation

I currently work with OpenCV C++ in Visual Studion 2013 (Community). I have installed the plugin ImageWatch into Visual Studio, which is useful debugging aid.
After a recent upgrade of Windows 10 (I was already was working with Win 10 and it was fine), I started to receive the following error : "exception has been thrown by the target of an invocation" when opening ImageWatch from 'View/Other Windows/Image Watch'
I have tried un-/re-installing ImageWatch and updated VS 2013 to the latest .Net Version (5.0) for 2013. I also, as suggested on other posts, where the same error has been generated for different reasons, shortened the length/removed some of the lengthy less used System Environmental Variables. All to no avail.
Part of the symptoms I received from Win 10 update were some missing .dll messages for MSVCP110.dll and MSVCR110.dll, generated directly after start up (of my PC). A quick search indicated that I was missing some crucial Visual C++ Redistributable x64 and x86 updates for Visual Studio 2012. (see http://answers.microsoft.com/en-us/windows/forum/windows_8-winapps/the-program-cant-start-because-msvcr110dll-is/f052d325-3af9-4ae5-990b-b080799724db)
These can be download here:
https://www.microsoft.com/en-us/download/details.aspx?id=30679#
After installing these updates for x64 and x86 and a reboot, the dll messages disappeared at start. Following a reinstallation of ImageWatch plugin, I no logner recieved the "exception has been thrown by the target of an invocation" and Image Watch was opening and running fine.

jvm.dll seems incompatible with Visual Studio 2013

I am dynamically loading (server) jvm.dll into my 64-bit Visual Studio 2013 C++ application using LoadLibrary(), in order to execute native Java code using JNI.
In the VS debugger, I am getting a number of access violations as the dll is being loaded (yet things seem to work if I 'continue' after these); and then a hard crash when some JNI calls are being invoked. I have tried jvm.dll's from Java 1.7 and Java 1.8, with the same issues.
I suspect the issue to be runtime library incompatibility. Dependency walker indicates that even the latest jvm.dll depends on msvcr100.dll (from Visual Studio 2010). I have heard dire warnings of the consequences of using incompatible runtime versions; and have seen the results first hand in other instances.
Has anyone else run into this problem? Is there any version of jvm.dll available that is compiled against Visual Studio 2013?
Thanks,
Dan
Just recently (Feb 2015) I compiled a JNI application which invokes the JVM to run a Java program. I used the most recent JRE version (1.8.0_31) and Visual Studio 2013. I am also loading the jvm.dll at runtime. Take a look at this post if you want to see how I setup my JNI calls.
So it is possible...
Make sure that the JRE containing jvm.dll is built for the same architecture (32bit or 64bit) as your Visual Studio project. If you are using 64bit, you may need to add the x64 as your configuration. To do this go to:
Solution --> Properties --> Configuration Properties
Also make sure your includes/libraries are correct.
For my project, I needed to include the following:
C:\Program Files\Java\jdk1.8.0_31\include
C:\Program Files\Java\jdk1.8.0_25\include\win32
Also, I needed to include jvm.lib which is located at:
C:\Program Files\Java\jdk1.8.0_31\lib
Make sure you also add the jvm.lib to your linker input. Alternatively you can use the preprocessor:
#pragma comment(lib, "jvm.lib")
Hopefully, this should help get your project configured right. If you are still having errors, I would recommend uninstalling Java completely, and re-installing after. Perhaps the same with Visual Studio 2013 as well...

Tried renaming a managed c++ project in Visual Studio, getting resource errors now

I tried renaming a c++ project in Visual Studio and I'm now getting the following errors:
An unhandled exception of type
'System.Resources.MissingManifestResourceException' occurred in
mscorlib.dll
Additional information: Could not find any resources appropriate for
the specified culture or the neutral culture. Make sure
"OuiDesktop.PreForm.resources" was correctly embedded or linked into
assembly "OuiProject" at compile time, or that all the satellite
assemblies required are loadable and fully signed.
I get this for every each form that uses a resource. If I comment these lines of code out that raise this error, the program launches okay, but I need the resources.
What have i done wrong? Seems renaming a project in Visual Studio is a nightmare!!
These .resources files are being created in the build directory just fine, just not being included in the assembly!
I was using Visual Studio Express 2010 on this machine. Creating a new project and adding the source files back into that in Express didn't work.
I tried this same fix on another machine with full Visual Studio 2010 Professional and it worked perfectly.