Questions tagged [badimageformatexception]

The exception that is thrown when the file image of a dynamic link library (DLL) or an executable program is invalid.

Filter by
Sorted by
Tagged with
1 vote
1 answer
48 views

BadImageFormatException for UnitTest with C#

I'm working with this code on C# and at the beginning I couldn't run it because it threw this exception: 'BadImageFormatException ERROR (HRESULT 0x8007000B)'. I resolved it by simply changing: Tools -&...
Francesco Vargas's user avatar
0 votes
0 answers
44 views

Why might I be getting System.BadImageFormatException from a C# console app that calls sub20dnc_v4.dll?

I'm trying to create a C# console app that accesses a USB device via sub20dnc_v4.dll (a third-party driver and .Net library available at http://www.xdimax.com/sub20/sub20.html#DLD). The library is ...
John Rager's user avatar
0 votes
0 answers
78 views

System.BadImageFormatException: Could not load file or assembly. Format of the executable (.exe) or library (.dll) is invalid

So I'm making a Microsoft Flight Simulator plugin that gets some data from the sim and makes something with it, doesn't really matter as i'm not there yet... Im using SimConnect to connect with the ...
Thypa's user avatar
  • 1
2 votes
1 answer
522 views

In Xamarin, how do I handle a "Read out of bounds" image exception that seems to happen only whenever the soft keyboard is removed?

I'm encountering the following exception in my Xamarin.Forms application on my GalaxyS22+ whenever the soft keyboard is removed from the view for any reason. System.BadImageFormatException: Read out ...
Zach Murphy's user avatar
0 votes
1 answer
60 views

BadImageFormatException with AnyCPU build [duplicate]

I have to use an old DLL for my current software that causes a BadImageFormatException when called during runtime. I have read that this is a typical 32 bit / 64 bit mismatch problem, so I set the ...
Thern's user avatar
  • 1,029
0 votes
0 answers
123 views

Precompiling views in .NET 4.8 give this error on some views at runtime: System.BadImageFormatException No string associated with token

since last few days, our Web Application build in .NET 4.8 and hosted as an azure app service throws this exception in some views. Here is the stack trace for one of these exceptions. We have run out ...
Muhammad Hamid Rafique's user avatar
0 votes
1 answer
117 views

System.BadImageFormatException on corrupted memory?

I'm getting a System.BadImageFormatException, but not when loading a DLL when I would expect to get it. I'm getting it when I set a bool in a class to true after replacing the dlls on disk. It's ...
Isaac's user avatar
  • 334
1 vote
1 answer
66 views

Is there a way to avoid BadImageFormatException on Assembly.Load by pre-analyzing

I have an application, that loads all the .dlls the user puts into a special directory. If they are created wrong (x86,x64) or something else, an BadImageFormatException is thrown. Thats ok, but I don'...
Malior's user avatar
  • 1,241
0 votes
0 answers
38 views

How to catch LoadLibrary exception of "Bad Image" [duplicate]

When I am trying to load a binary file with a magic start of "DCS" instead of the common "MZ", it fails with an error: C:\Windows\winsxs\x86_wcf-system....
E235's user avatar
  • 12k
2 votes
0 answers
253 views

VS Community - Cannot run a simple console application: Could not load file or assembly ‘System.Reflection.Metadata'

I’ve installed Microsoft Visual Studio Community 2019 Version 16.9.4 and tried to create a simple console application to print “Hello World”. If I run the app with dotnet run from the Windows Command ...
felipe.zkn's user avatar
  • 2,010
3 votes
1 answer
303 views

Jenkins service no longer starting after system update

I'm getting a BadImageFormatException after our servers received a Windows Update. Googling only hints at .NET mismatches but I can't find any problems there. Jenkins Version is 2.263.1 Edit: Removing ...
NoCoffeeNoCode's user avatar
1 vote
0 answers
297 views

Could not load file or assembly 'System.ComponentModel.TypeConverter netcore 1.1

I got this exception when I run my project in docker container with netcore 1.1 to type 'System.String'. ---> System.BadImageFormatException: Could not load file or assembly 'System.ComponentModel....
Bui Quang Huy's user avatar
-1 votes
1 answer
117 views

Emgu DLL not found and Bad Image Format exceptions in Windows 8.1

I have a .Net application using Emgu.CV v 3.1 which runs OK after being installed on Win 10 but fails on Win 8.1 64 bit with a Type Initializer exception, with an InnerException DLLNotFound for dll '...
SimonKravis's user avatar
2 votes
0 answers
100 views

How to load C++ dlls of the same name in C# project

I have two C++ WinApi(only x64 arch) dlls of the same names, which contain API of some project, for example C:\first\MyDll.dll and C:\second\MyDll.dll. I can't rename it in my case. So they can't be ...
Artem's user avatar
  • 21
0 votes
1 answer
232 views

Nuget NLog 64bit

I have a asp.net app, using NLog. I can run it for x32 platform with success. But for x64 platform I get error on start: BadImageFormatException Could not load file or assembly or one of its ...
Taras Kolomiets's user avatar
0 votes
1 answer
320 views

How to get lab streaming layer to work in C#?

I have a device that records live data like eeg measurements. I want to send these data with a lab streaming layer (lsl). Unfortunately I'm unable to configure the lsl and get it to run. I'm not sure ...
purbsel's user avatar
  • 307
1 vote
0 answers
335 views

System.BadImageFormatException: Could not load file or assembly Microsoft.Bcl.AsyncInterfaces

I currently am trying to connect to a SignalR Asp.net Core 3.1 service from my WPF application. The code works fine until I create a .msi file and try to install it. I am using the Visual Studio ...
JanMer's user avatar
  • 1,216
0 votes
1 answer
448 views

WIX install windows service with x64

I had to change my project to x64 and now following this tutorial I try to change my WIX installation to x64 also. But the WIX installation tries to install a windows service. This service throws the ...
Felix Arnold's user avatar
1 vote
1 answer
1k views

System.BadImageFormatException when compiled using any cpu

When I compile the application using "Any CPU" I am getting System.BadImageFormatException whenever I try to open a connection using Firebird embedded dll (don't ask me why I am still using this ...
Steve's user avatar
  • 11.7k
0 votes
0 answers
119 views

Adding DLL file to Resources as content causes copying it to the bin output folder and BadImageFormatException on startup

I'm using the old VS 2015 Pro (C# project) and it seems like there is a bug or I don't understand something. As I discovered by experimenting, adding copies of a dll file (that is already referenced ...
P.W.'s user avatar
  • 677
1 vote
0 answers
63 views

How to fix exe launch after installation is finished

I tried to launch an application after installation is finished but it gave error of BagImageFormat I tried mostly all the provided solution on stackoverflow and on different websites also like using ...
Amrit Sharma's user avatar
1 vote
1 answer
2k views

BadImageFormatException and valid Win32

I have a C# application that runs well on my work laptop. However, the same application cannot run on my home laptop, I get an error saying: System.BadImageFormatException HResult=0x800700C1 Message=...
Bug's user avatar
  • 862
0 votes
0 answers
80 views

BadImageFormatException when running web app on IIS, but all my projects are Any CPU

I have an ASP.NET web app I'm trying to run on a local IIS, but when I do so I get a BadImageFormatException. This happens even though all my projects are set to Any CPU. Nothing is wrong with the web ...
ekolis's user avatar
  • 6,318
0 votes
1 answer
738 views

SystemBadImageFormat Exception on IIS

Hi I have an application running on iis with .net 4.7.2 and windows server 2016.Sometimes I got SystemBadImageFormat Exception: Bad Token error or SystemBadImageFormat Exception a valid typedef or ...
Bilgehan's user avatar
  • 1,187
2 votes
1 answer
1k views

System.BadImageFormatException in UWP with WPF desktop bridge package

I''ve fully and detailed described problem and question in this topic System.NullReferenceException in AppServiceResponse and System.BadImageFormatException of UWP with WPF desktop bridge package, but ...
user avatar
0 votes
2 answers
568 views

How to fix "BadImageFormatException" with MatroxImagingLibrary?

I'm working on Visual Studio, on a C# .NET project. I'm trying to use the MatroxImagingLibrary, so I downloaded it from Nuget but it doesn't worked. An exception is thrown : "System....
LeoH's user avatar
  • 13
0 votes
0 answers
115 views

BadImageFormatException when testing AutoCAD API with NUnit

I created a DLL library for AutoCAD, using AutoCAD API. Now I'm creating another project in the same Visual Studio solution so I can unit test some methods I created for the library. I created the ...
AwesomeGuy's user avatar
1 vote
1 answer
964 views

How to connect UiPath to Oracle DB?

I am getting this error while connecting UiPath to Oracle DB: BadImageFormatException. This occurs when running in 64-bit mode with the 32-bit Oracle client components installed.
Binod's user avatar
  • 11
3 votes
0 answers
1k views

Running IIS Express in 32-bit crashes my ASP.NET Core web application

I have an ASP.NET Core web application which I'm trying to run in 32-bit with IIS Express. I followed other guides and tips to make IIS run in 32-bit, but every time i try to run the application it ...
Tobiuo's user avatar
  • 303
2 votes
0 answers
166 views

What does BadImageException mean and how do I fix it?

I have a project using .NET Core 2.1 SDK and I want to use a dll on my project. The Dll use Pechkin.synchronized NuGet Package. I referenced the dll my project create an instance and invoke a ...
Bunyamin Aslan's user avatar
0 votes
1 answer
38 views

VS2017 Could not load file or assembly

I have gone over every example I can and I can't seem to get this error to go away. I have tried = Setting build from x64 to x86 to AnyCPU = no work I have tried deleting IIS Express folder = no ...
RenleyRenfield's user avatar
1 vote
2 answers
2k views

Azure App Service threw System.BadImageFormatException after upgrading my app to Asp.net Core 2.1.1

I upgraded my web app to the latest Asp.net Core 2.1.1 and then I pushed it to Azure App Service from GitHub directly. When I accessed my site, I got 500 and the log is showing the following ...
Ray's user avatar
  • 12.2k
2 votes
0 answers
82 views

I've tried reinstalling ms office and also installed office tool runtime. I'm still getting this error while exporting data to an excel file

System.BadImageFormatException: 'Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 800700c1 is not a valid Win32 ...
datestone's user avatar
0 votes
1 answer
638 views

.NET 4.0 WinForm - Could not load file or assembly or one of its dependencies. is not a valid Win32 application

I have an application that works on most Windows 10 (64-bit) systems, but there are 6 computers that are getting this same BadImageFormatException. The application and libraries are targeting AnyCPU. ...
VaultBoy13's user avatar
1 vote
1 answer
788 views

Hangfire server unable to pick jobs when Windows service is hosted in release mode

I am hosting hangfire server inside Windows Service so that when my ps starts hangfire server starts automatically and start executing job. Now the problem is when I host my Windows service in debug ...
I Love Stackoverflow's user avatar
0 votes
1 answer
56 views

Moq Unit Test disappear after solving badimageformatexception

So I had this problem : badimageformatexception I had it once already, and solved it quickly. But now I pulled a referenced project from Git, and when I match the correct CPU parameters in my test ...
aurelienjo's user avatar
0 votes
1 answer
784 views

Getting BadImageFormatException: Could not load file or assembly Microsoft.AspNetCore.Razor.Language

I am trying to deploy my app on a host, and first it worked perfectly. But then I get back to my code made some changes there (javascript only) and when i try to publish again it shows me this error. ...
Ertan Hasani's user avatar
1 vote
1 answer
448 views

BadImageFormatException when trying to install msi

I am using VS 2015 and .net framework 4.6. I have one solution with multiple projects. When i build the solutions it works fine. I build solution and all the projects for Release x64. I have one ...
Developer's user avatar
  • 173
1 vote
0 answers
500 views

building VSIX project under x64 bit platform

The following steps: Create new VSIX project in Visual Studio 2015 (C# -> Extensibility -> VSIX Project); Switching the platform from 'Any CPU' to x64 in Configuration Manager; Add new Custom ...
Andrey Lyubimov's user avatar
0 votes
2 answers
642 views

BadImageFormatException, when trying to add .dll file to C# project - Intel realsense SDK

Every time i try to compile i'm getting this error: System.BadImageFormatException: 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)' when i ...
mowinka's user avatar
1 vote
2 answers
349 views

System.BadImageFormatException when trying to resolve constructor of System.Collections.Generic.GenericComparer`1

I have a problem with the following code: var type1 = typeof(object); var type2 = type1.Module.GetType("System.Collections.Generic.GenericComparer`1"); var constr = type2.GetConstructor(BindingFlags....
Florin's user avatar
  • 11
15 votes
3 answers
63k views

BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format

I am getting following runtime error, with my console application(VS2012) which refers to "dcasdk.dll". .Net Framework of the console app is 4.5, platform target is "Any CPU". Could not load file or ...
SSQs's user avatar
  • 289
-1 votes
1 answer
49 views

BadImageFormatException on 32bit app running on 64bit PC

I'm developing a .NET C++ application. I'm using a fingerprint's sensor whose main library only works on 32bits, and has many dependencies, one of them is msvcr110.dll. I know that this DLL comes with ...
Inés Ortega Fernández's user avatar
0 votes
0 answers
251 views

Many of the time getting "result_code" as "BadImage" when uploading image of 24bit RGB PNG image to vuforia

Many of the time getting "result_code" as "BadImage" when uploading image of 24bit RGB PNG image to vuforia. If i am converting same image to JPEG then its getting uploaded properly. So not able to ...
Sanket Virani's user avatar
1 vote
0 answers
541 views

System.BadImageFormatException in ASP.net application

I have a asp.net web application. This is working fine in local PC. But when I try to deploy it on server i got this error msg Could not load file or assembly 'NuGet.Server, Version=2.8.50926.602, ...
prageethsy's user avatar
0 votes
1 answer
149 views

BadImageFormatException when deploying on Hololens

I'm currently part of a small team working on a project for HoloLens. We're facing a problem when deploying on an unit: My team-mate can deploy from his computer and run the program, but when I do it ...
Laurent Taymans's user avatar
1 vote
1 answer
2k views

Could not load file or assembly 'System.Data.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

I'm facing this problem. I've searched for all sorts of solutions for this but to no avail, finally decided ask here. The web application is a .net 4.0 deployed with IIS in a staging server, it has ...
Ling's user avatar
  • 11
0 votes
0 answers
283 views

Mulitplatform application crashes with System.BadImageFormatException in Relase mode but works fine in Debug

I have an application that I've recently had to add a mixed platform (some 32-bit some 64-bit) component to. For the 64-bit build, one .exe is 32-bit, the rest are 64-bit, and all the DLLs are set to ...
Ultratrunks's user avatar
  • 2,474
1 vote
2 answers
4k views

NUnit: Could not load file or assembly 'some.dll' or one of its dependencies. The specified module could not be found

I have a C++/CLI DLL that uses some C++ DLLs (both built for 32 bit). I want to test it within a C# DLL by using NUNit 2.5.8.10295 (changing to 2.6.4 did not change the outcome) I use a batch file ...
Florian Straub's user avatar
1 vote
0 answers
958 views

C# Controller unit tests failing with bad image format exception, when referenced to service project

C# Controller unit tests failing with the below bad image format exception, when referenced to service project. Both the service and unit test project are being built as AnyCpu. Any suggestions on ...
SteelBird82's user avatar