My project uses another lib project as reference.
I get this error when trying to run a project in "Relase" Mode, In "Debug" Mode it works fine.
It says that it cannot load the lib project because :
"An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'UserManagementProviders,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
An attempt was made to load a program with an incorrect format."
BadImageFormatException means 32/64 bit mismatch. Check your project configurations. The x86/x64/Any CPU settings must be messed up among Debug and Release configurations.
I think this is related to the difference in 64bit and 32bit DLL builds and processes.
Try compiling to 32bit by changing project properties/Build/Platform Target.
Related
I am using Windows Application to communicate with Oracle 11g database to fetch some data. Oracle database was installed on the X64 bit system.
My Application builds successfully on my system (the x86 bit) with x64 bit dlls of Oracle. But when I run application below mentioned errors occurred.
An unhandled exception of type 'System.BadImageFormatException' occurred in your application(E.g. MyApplication.exe)
Additional information: Could not load file or assembly 'Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I had tried different ways to resolve this issue but still unable to found a solution for same. Please help me to resolve this issue.
You are trying to load a 64bit DLL from a 32 bit process or vice versa. Make sure the DLLs you want to load have the same bitness as your process.
I have done some extravagant web searching for a solution to no avail.
I am working with a UI tester written by a man who is no longer with the company.
Currently it is hanging up on opening the browser for testing the website.
I have no idea what I'm doing.
BrowserWindow.CurrentBrowser = "ie";
"An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.VisualStudio.TestTools.UITesting.dll
Additional information: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITest.WindowsStoreUtility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
Figured out what the issue is. I can't run it directly. I have to pass it to MSTest.exe with arguments.
If you don't know where MSTest.exe is, here is where mine is, and most likely yours.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe
I am trying to use LinqPad's dump feature (https://stackoverflow.com/a/9437947/3375305) from within Visual Studio. (.netCore 1.1 Console App).
I have added a reference to LinqPad.exe, but whenever I try and run the program, a File Not Found exception is thrown.
System.IO.FileNotFoundException: 'Could not load file or assembly
'LINQPad, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=21353812cd2a2db5'. The system cannot find the file
specified.'
I have tried LinqPad 5.10, 5.10 AnyCPU, 5.21 AnyCPU (Beta)
I got the error mentioned as below on client machine. For some systems it is working well but for some I get the error mentioned as below:
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
System.TypeInitializationException: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception. ---> System.BadImageFormatException:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies.
An attempt was made to load a program with an incorrect format.
It could be useful to someone: if you have the option to do it, go to IIS and set the Application Pool to 32 bit applications only.
That made the trick for me.
(Of course, your application could be made to run only on 64 bit. In that case, I think the installing of the 64 bit redistributable of CrystalReports should solve the issue)
I am trying to provide a colleague with a dll that is from my build so she can execute with the changes i have made. Unfortunately she gets the following error
The system was unable to launch the requested screen. --->
Unable to display screen.
---> System.IO.FileLoadException: Could not load file or assembly 'file:///name.dll' or one of its dependencies. Operation is not
supported. (Exception from HRESULT: 0x80131515) --->
System.NotSupportedException: An attempt was made to load an assembly
from a network location which would have caused the assembly to be
sandboxed in previous versions of the .NET Framework. This release of
the .NET Framework does not enable CAS policy by default, so this load
may be dangerous. If this load is not intended to sandbox the
assembly, please enable the loadFromRemoteSources switch
Now if she were trying to run it in visual studio i could set the loadFromRemoteSources switch - however this dll is replacing a dll in an install version on a vagrant box. How can i enable the dll to run in this scenario?
Thanks