Windows error 0x8007000B, -2147024885

Detailed Error Information

BAD_FORMAT[1]

MessageAn attempt was made to load a program with an incorrect format.
Declared inwinerror.h

COR_E_BADIMAGEFORMAT[2]

Message"The format of a DLL or executable being loaded is invalid."
Comment The format of DLL or executable being loaded is invalid.

HRESULT analysis[3]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode7 (0x007)
NameFACILITY_WIN32[3][1]
DescriptionThis region is reserved to map undecorated error codes into HRESULTs.[3][1]
Error Code11 (0x000b)

This is a Win32 error which has been mapped into an HRESULT. More information may be available in error 0x0000000b.

Questions

485votes
21answers

"An attempt was made to load a program with an incorrect format" even when the platforms are the same

I'm calling functions from a 32-bit unmanaged DLL on a 64-bit system. What I get is: > BadImageFormatException: An attempt was made to load a program with an > incorrect format. (Exception from HRESULT: 0x8007000B) At first, I had my projects set to the Any CPU platform, so I changed [...] read more
.net
64-bit
pinvoke
32-bit
badimageformatexception
116votes
21answers

Troubleshooting BadImageFormatException

I have a Windows service written in C# using Visual Studio 2010 and targeting the full .NET Framework 4. When I run from a Debug build the service runs as expected. However, when I run it from a Release build I get a System.BadImageFormatException (details below). I've been searching the [...] read more
c#
.net
exception
42votes
21answers

BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed

I am getting this error while on of my .Net application are trying to make a connection to oracle database. The error says that This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.. But I have made sure many times that [...] read more
.net
oracle
oracle11g
27votes
11answers

BadImageFormatException when AnyCPU test assembly implements interface from x64 production assembly

I seem to have hit on a scenario where when I run mstest on an AnyCPU assembly which references an x64 assembly, I get a BadImageFormatException. The issue occurs when an interface in x64Production.dll is implemented (even if unused) by the AnyCPUTestingx64Production.dll test assembly: Unable to load the test container [...] read more
c#
visual-studio-2010
mstest
64-bit
22votes
10answers

.net Framework Error (HRESULT 0x8007000B)

I have a C# application which was written on a 32bit windows XP machine with Visual Studio 2005. The application runs fine on Windows XP machines, however when I try to run it on a 64bit Windows 7 professional machine, I get the following dialog-box on start up: enter image [...] read more
c#
.net
x86
64-bit
21votes
2answers

Why does calling a generic local function with a dynamic parameter produce a BadImageFormatException?

Playing around with C# 7's Local Functions, I ended up with some interesting behavior. Consider the following program: public void Main() { Console.WriteLine("Entered Main"); DoSomething(""); } private void DoSomething(object obj) { Console.WriteLine("Entered DoSomething"); Generic((dynamic)obj); GenericLocal(obj); GenericLocal((dynamic)obj); // This breaks the program void GenericLocal<T>(T val) => Console.WriteLine("GenericLocal"); } private void Generic<T>(T [...] read more
c#
generics
dynamic
c#-7.0
17votes
4answers

ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated

I'm getting the following error using visual Studio Express 2013 for Web. It previously work on 32 bit. My laptop is 64 bit Windows. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated. I've rebuild the solution with 64 bit cpu selected and no joy. read more
visual-studio
64-bit
visual-studio-exp-2013
15votes
4answers

BadImageFormatException debugging web site running in x64 mode

There are a lot of questions on this forum about the BadImageFormatException, but none quite matches my issue. I have a solution containing several projects. When I run in Debug or Release + Any CPU, everything works fine. When I switch to x64, however, and run my ASP.NET MVC project, [...] read more
c#
asp.net-mvc-4
14votes
2answers

UWP appx package Signtool "Error: SignerSign() failed." (-2147024885/0x8007000b)

EDIT Event log error was this: error 0x8007000B: The app manifest publisher name (CN=...) must match the subject name of the signing certificate (CN={19BE29DF-4812-4F2E-8FC1-A138B146946A}). The command below now seems to work. So either user error on my part that I cannot identify or something hinky with the state of machine [...] read more
windows-store-apps
signtool
appx
desktop-bridge
desktop-app-converter
9votes
3answers

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 assembly 'dcasdk, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program [...] read more
c#
.net
.net-assembly
badimageformatexception
target-platform
8votes
3answers

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

I am trying to use 64-bit Sqlite on my Aspx project. When I run the project, I got the following error: > Could not load file or assembly ‘System.Data.Sqlite’ or one of its > dependencies. An attempt was made to load a program with an incorrect format. I even set [...] read more
c#
asp.net
sqlite
7votes
2answers

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

I'm trying to build a sample web application from a blank web form template in VS2012, and add the PDFNet dll to it. If I run the project in .NET 3.5 no problem. If I run it in .NET >= 4 I get this error: Could not load file or [...] read more
.net
load
.net-assembly
6votes
2answers

C++/CLI targetting .NET Core 3.1

.NET Core 3.1 added support for C++/CLI (Announcing .NET Core 3.1). The official announcement lists two new project templates, CLR Class Library (.NET Core) and CLR Empty Project (.NET Core), which we can indeed find and use. However, there is no additional information about supporting technologies such as WPF or [...] read more
c++
winforms
.net-core
c++-cli
visual-studio-2019
6votes
5answers

Alternate cause of BadImageFormatException in .NET Assembly?

I'm working on a .NET 3.5 console application in C# which uses a VC++ unmanaged DLL. It ran without a problem when I worked on it a few weeks ago, but I'm coming back to it today and am now getting a BadImageFormatException ("An attempt was made to load a [...] read more
c#
c++
visual-studio
visual-studio-2008
dllimport
6votes
4answers

Using C++ DLL in C# project

I got a C++ dll which has to be integrated in a C# project. I think I found the correct way to do it, but calling the dll gives me this error: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) This [...] read more
c#
c++
dll
dllimport
5votes
12answers

The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception

I'm working on a project and have run into an issue. When I run my code I get this error message: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception The title of the message is "TypeInitializerException was unhandled". I receive this error at this line of code: this.crystalReportViewer = new [...] read more
c#
visual-studio-2010
crystal-reports-xi
unhandled-exception
4votes
3answers

Could not load file or assembly 'Microsoft.SqlServer.BatchParserClien.dll File Name

I have this crazy issue where a SMO operation is failing, and the only difference is this odd file in my bin folder: > Could not load file or assembly 'Microsoft.SqlServer.BatchParserClien.dll NOTE: That is not a typo, that is the actual name of the file in the file system. I [...] read more
c#
sql-server
visual-studio-2017
smo
4votes
2answers

Trying to run EF Code first Migrate.exe tool on production environment failed

I'm using EntityFramework version 6.1.3. I copied migrate.exe from EntityFramework version 6.1.3 package tool folder to bin folder of my website. My web site is compiled and published to production environment with x86 CPU and target framework 4.5.1 I run the following command: > D:\Sites\MatrixPortal\bin>migrate.exe > d:\sites\MatrixPortal\bin\MatrixPortal.BL.dll > /startUpDirectory="d:\Sites\MatrixPortal\bin" > [...] read more
entity-framework
entity-framework-migrations
4votes
3answers

WCF 64 bit not working

I'm trying to develop a simple WCF service running in a 64 bit environment. I fire up VS2010 under Windows 7 New Solution -> WCF project -> Run -> It works fine. As soon as I change the properties of the project in order to make it compile in 64 [...] read more
visual-studio
wcf
sharepoint
64-bit
3votes
1answer

Solution for running a 32 bit DLL in a 64 bit process or vise versa

I am running windows vista business 64 bit. I have a web service that was written in .NET using C#. I also have a client-side script on a web page that communicates with the web service. This is a aspx page titled "Default.aspx". I setup IIS and moved my web [...] read more
windows
iis
windows-vista
.net
3votes
3answers

OpenCVSharp: Unable to load DLL 'OpenCvSharpExtern'

I have installed the latest OpenCVSharp 2 (2.4.10.201...) with the NuGet manager in my project. Everything concerning OpenCVSharp.CvMat is working OK (loading, manipulation etc) so I am sure the installation is correct. However I cannot use OpenCVSharp.CPlusPlus at all! The problem is that it doesn't load OpenCvSharpExtern.dll. Error shown from [...] read more
c#
.net
opencv
opencvsharp
3votes
1answer

Install IIS with Inno Setup

I'm trying install IIS with Inno Setup, but I'm getting various errors. I tried command on DOS and works: > start /w pkgmgr > /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-ManagementService;IIS-CGI;IIS-RequestFiltering;IIS-ASPNET;IIS-HttpLogging;IIS-NetFxExtensibility;IIS-HttpErrors;IIS-DefaultDocument;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-StaticContent;IIS-ManagementConsole;IIS-DirectoryBrowsing;IIS-WindowsAuthentication;IIS-WebServer; I tried use this in Inno Setup: > Filename: pkgmgr; Parameters: "/iu:IIS-WebServerRole; IIS-WebServer: ; > IIS-CommonHttpFeatures: ; IIS-ManagementService: ; IIS-CGI: ; > IIS-RequestFiltering: ; IIS-ASPNET: [...] read more
windows
iis
inno-setup
3votes
1answer

Pythonnet in Visual Studio 2017

I am trying to run Visbrain using Pythonnet in Microsoft Visual Studio 2017 Community in a window form, but i faced some problem below. Environment 1) Pythonnet version : v2.3.0 i downloaded this from "Manage Nuget-Package" in Visual Studio 2017 Community. 2) Python version : Python 3.6.5 (Amaconda 3) Already [...] read more
c#
python
.net
visual-studio
python.net
3votes
3answers

Unable to load dll file - exception 0x8007007E

I'm working with National Instruments Measurement Studio in C#, and I've come across a bit of a problem in deploying my application to a particular computer (running Windows 7). I've tried asking on the National Instruments forums, but haven't got any solutions yet - could anyone here give me some [...] read more
c#
.net
dll
3votes
1answer

how to call a C++ dll from C# windows application project

I have created a dll in C++ using a Class Library project in Visual Studio. I need to call a method in the dll from a C# application. I got to know there are 2 approches. One is to add the dll project reference to C# project or use DllExport [...] read more
c#
exception
visual-c++
dllimport
2votes
0answers

How do I fix a corrupted WIM file?

TLDR I have a corrupt WIM archive that I'm trying to extract. I have tried using DISM, but it won't let me mount it because it doesn't recognize it as a WIM file. I have also tried editing it with a hex editor, but I don't know what I can [...] read more
windows-10
7-zip
dism
wim
2votes
2answers

System.BadImageFormatException while calling a rust dll from netcore c# console app

I have this simple rust function. #[no_mangle] pub extern fn add_numbers(number1: i32, number2: i32) -> i32 { println!("Hello from rust!"); number1 + number2 } which is compiled to dll with [lib] name = "my_lib" crate-type = ["dylib"] I tried to use the dll from a C# console app (full framework), [...] read more
c#
.net-core
rust
interop
2votes
1answer

An attempt was made to load a program with an incorrect format (.dll)

My program compiles nicely, but when I run the program I get this error: > "System.BadImageFormatException thrown calling IO_Init(). Message=An attempt > was made to load a program with an incorrect format. (Exception from HRESULT: > 0x8007000B)" As far as I understand, this error is because my program tries to [...] read more
c#
visual-studio
dll
2votes
0answers

How can I fix the Keras.NET BadImageFormatException exception?

I created a machine learning model with keras using python. I saved this model in a .h5 file and want to use that file in my ASP.NET Core API. To load the model I am using Keras.NET. The problem I am encountering is that when I try to debug the [...] read more
python
asp.net-core
keras
.net-core
2votes
0answers

Where shall I put a DLL generated in another project from the same solution -I am using Visual Basic Visual Studio 2017-?

I have created a C++ DLL in Visual Studio 2017 using the following sources: Header: stdfax.h // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #define WIN32_LEAN_AND_MEAN // Exclude [...] read more
c++
vb.net
dll
2votes
1answer

Error in Importing "Interop.zkemkeeper.dll" to WCF Service

I have "WCF Service Application" which is .net framework 4.6.1. I need to add "Interop.zkemkeeper.dll" as a reference. but when I added this as reference to the WCF service and when service stated it shows following error on the browser. "Server Error in '/' Application. Could not load file or [...] read more
c#
wcf
visual-studio-2017
zkteco
2votes
1answer

SignTool error: SignerSign() failed." (-2147024885/0x8007000b) when signing msi file

We recently purchased an EV Code Signing Certificate. I followed instructions and I can successfully sign our built applications (exe files), our libraries (dll). However, I can't sign our setup packages (MSI files), I always get this error: > SignTool Error: An unexpected internal error has occurred. Error information: > [...] read more
signing
signtool
2votes
1answer

Lightweight Oracle support in .NET core

I'm trying to connect to an Oracle database from a containerable dotnet core application, and haven't been able to find a solution that allows me to do this that fits all of these criteria: * Runs in .NET Core 2.0 * Doesn't require extra installation on the machine running it [...] read more
oracle
.net-core
1vote
1answer

Unable to load DLL 'Msacm32.dll': The specified module could not be found

I would like to add to this issue. This was working previously when I was running our old DC Server running an older installation of Windows 2016 Server DC. Once we lost that DC, and then a hard drive failure took out the backup DC, along with the entire Web [...] read more
iis
windows-server-2016
1vote
0answers

Trying to boot from live usb stick but during startup but it says it cannot find the appropriate drivers

Former title Trying to boot from live usb stick but during startup but it says it cannot find E:/source/install.wim (error code 0x8007000B) Recently I've been trying to make a bootable live win 10 usb.I partitioned the disk into 2 segments, a 1.1 GB FAT32 and a 50~ GB NTFS segment, [...] read more
boot
usb
partitioning
ntfs
1vote
1answer

How do you fix error 0x8007000b in Windows Live Photo Gallery?

When you start Windows Photo Gallery (formerly Windows Live Photo Gallery, now part of Microsoft Essentials 2012), you may receive the following errors, and the application will close: Windows Live Photo Gallery encountered an error and can't start. Error Code: 0x80070043 read more
windows
windows-photo-gallery
1vote
3answers

Visual Studio Package Installation Error: "Failed to initialize the PowerShell host."

I'm facing this error when I'm trying to create a webApplication Project, a message like below appears: > Package Installation Error > > Could not add all required packages to the project. Thw following packages > failed to install from 'C:\Program Files (x86)\Michrosoft Web Tools\Packages': > > Microsoft.Web.Infrastructure.1.0.0.0: Failed to [...] read more
visual-studio
visual-studio-2015
1vote
2answers

pvk2pfx does not allow me to create a pfx file with an empty private key password

We created the certificate request and the private key with openssl as follows req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key We sent the CSR out and after verification, we got back the spc file. Now I want to sign my code with signtool. Apparently, I need to generate [...] read more
pfx
signtool
1vote
3answers

Visual studio 2015 and 2017 do not start IIS Express 64 bit version

Even though I have set up visual studio to run IIS Express 64 bit, it continues to start IIS Express 32 bit. I need to run the 64-bit version because I have some references that will only work on a 64-bit host environment. * My projects were created based on [...] read more
visual-studio
azure-web-app-service
iis-express
azure-cosmosdb
1vote
1answer

.Net Core web API Docker (Linux) - unable to load libMyCpp.so file

I have a .NetCore web API and and need to connect with a C++ shared library (libCppAppOutput.so). For this I am using DllImport inside the controller of the Web API as in the below code: [DllImport("libCppAppOutput.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, EntryPoint = "methodNameinCppProject")] public static extern int MethodNameInWebAPI(string [...] read more
docker
shared-libraries
asp.net-core-webapi
docker-container
.so
1vote
0answers

T4 Templates Assembly load stopped functioning when I upgraded to .Net 4.8

I have a T4 template that was working when my project was using .Net 4.6.2 with the following lines in my template. I am using Visual Studio 2019. <#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ assembly name="$(SolutionDir)MyProject\bin\x64\Debug\MyProject.FooBar.dll" #> <#@ output extension=".cs" #> <#@ import namespace="System.Collections" #> [...] read more
t4
.net-4.8
1vote
3answers

Calling a Fortran subroutine from C# at the console

I want to call a Fortran subroutine from C# using commands entered at the console. I have been trying for two days now, reading many web pages, and following much advice, but with no success. Here is a typical example of my many failed attempts. Using a text editor (Notepad) [...] read more
c#
fortran
interop
1vote
0answers

I am unable to use Nuget Nlua to read .lua file in C#

Using visual studio with class application I added the NLua via NuGet. I want to read in and .lua file (BTW, of there is a better way do let me know) My code is this: ... using NLua; ... using (Lua lua = new Lua())... But when I run it [...] read more
c#
lua
nlua
1vote
0answers

C# based DLL wrapping C based DLL Usage Problem

I have code written in ANSI C that I would like to use in C#. I have compiled the C code into a DLL and created C# wrapper classes to interop with the C code. The point of the wrapper is to simplify a users interaction with the underlying C [...] read more
c#
c
dll
interop
wrapper
1vote
0answers

msbuild warnings - MSB3246 & NETSDK1049

I'm working on migrating from packages.config to PackageReference format for multiple csproj files. Restore and build succeeds but with hundreds of warnings. These warnings were not showing before my PackageReference changes to csproj files. Please let me know if you could guide on resolving these. warning NETSDK1049: Resolved file has [...] read more
msbuild
packagereference
1vote
0answers

TWAINDotNet throwing BadImageFormat exception

I have a .Net 4.5 WPF MVVM application I have added scanning support using the TWAINDotNet. All of the scanning features work fine until I build in Release and deploy. I confirmed that everything is getting built using the same .Net and "Any CPU" for the processor. > 2020-04-03 16:06:33,169 [...] read more
c#
wpf
mvvm
twaindotnet
1vote
0answers

ManagedBass Wasapi dll UWP

I have to retrieve the device output data to create a stream with ManagedBass.Wasapi.dll, but an error is returned despite having copied the basswasapi.dll to the system32 folder and to the app's debug folder. MainPage.xaml.cs: private void BtnWasapi_Click(object sender, RoutedEventArgs e) { var device = BassWasapi.CurrentDevice; } I installed the [...] read more
c#
uwp
wasapi
1vote
1answer

BadImageFormatException: Attempting to use a C++ DLL file in C#?

Win32 C++ DLL project is saved in my bin/Debug file with the other DLLs. Running Debug x86 mode on my C# project. From previous attempts to solve this problem I have changed the Build Configuration to x86 from x64 but I still receive the same error. namespace ComputerToArduino { public [...] read more
c#
c++
dll
x86
1vote
1answer

EmitIL - Call method with ref parameter

I am trying to write the Following code in MSIL: class ReferenceTestViewModel : BaseViewModel, ITestViewModel { private int id; public int Id { get { return id; } set { this.SetProperty(ref id, value); } } } SetProperty being a method of its grand-father BaseObservable (BaseViewModel : BaseObservable). So I compiled [...] read more
c#
reflection.emit
1vote
2answers

How to use FreeImage.NET in a x64 targeting project (AnyCpu)?

I'm trying to use the FreeImage .NET wrapper in my project, my ptoject targets AnyCPU and the dll wrapper will not work under this, it will only works if I target x86 machine. When I try to load a file using the wrapper targeting AnyCPU or X64 it throws this [...] read more
c#
.net
vb.net
freeimage
target-platform
1vote
2answers

Custom AssemblyLoadContext failing to load Microsoft.AspNetCore.Components

Edit: I have uploaded the source code for the issue to GitHub if you would like to download: https://github.com/bryanenroute/assemblyloadcontext-issue I have a .NET Core 3.0 console application that references a .NET Standard 2.0 class library with a single interface (IModule). I also have a ASP.NET Core 3.0 application that references [...] read more
c#
asp.net-core
.net-core
1vote
0answers

IIS is not installing in server

I am installing IIS using wix burn which works fine in my local. When I am trying to install in server it's getting failed to install, and the error is an attempt was made to load a program with an incorrect format. <!--Check For IIS Existance--> <util:RegistrySearch Id="IISWebServerRole64" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp\Components" [...] read more
iis
wix
burn
1vote
3answers

Win32 DLL not found error in Azure Web Application

I have a web application which is hosted in Azure. When I run the app and authenticate the user, I am getting the error "One of the dependent DLL not found". Background: In the web application, I am using fingerprint scanner functionality to capture a fingerprint image. To capture fingerprint [...] read more
c#
azure
asp.net-core
azure-web-app-service
paas
1vote
0answers

"UWPHost.pdb not loaded" - Debugging Xamarin UWP app

I have a Xamarin app for which I have been debugging the UWP app on my computer for testing. I've been having difficulties debugging. I keep getting a 'No Symbols Loaded' error which goes onto say one of the following errors: > UWPHost.pdb not loaded or > wkernelbase.pdb not loaded [...] read more
visual-studio
xamarin
visual-studio-debugging
1vote
0answers

Why does downgrading my framework version and then upgrading again allow this .dll to load properly?

I am trying to automate some data collection using an Oscilloscope. I have a USB scope with plenty of examples. The examples worked just fine, but when I tried to create my own project things stopped working. I have mirrored their setup with respect to the .dll location and which [...] read more
c#
.net
1vote
0answers

C# Generic DynamicMethod with no type parameters

For performance reasons, I am trying to write an IL delegate that can return a random KeyValuePair from a dictionary without having to use enumeration. To do this, I am directly reading from the dictionary's _bucket and _entries fields. Dictionary is a generic collection, but I would like to avoid [...] read more
c#
delegates
cil
1vote
0answers

Loading C# assembly from MemoryStream: Bad IL format. How to correctly load fully in-memory assembly?

Using .NET Core 2.1 and Microsoft.CodeAnalysis.CSharp.Scripting 2.10.0 to dynamically compile to assembly and keep it in-memory. Then trying to load this assembly via AssemblyLoadContext getting > Bad IL format How to correctly load fully in-memory assembly? What is the reason of this exception? I am missing to specify some metadata [...] read more
c#
.net-core
dllimport
asp.net-core-2.1
0votes
1answer

New IIS site - WebApp Error

I setup IIS. I moved my folder with all the files to the IIS directory. Now when I go to http://localhost/thefolder I get: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Description: An unhandled exception occurred during the execution of the current [...] read more
iis
0votes
1answer

“An attempt was made to load a program with an incorrect format” - Unknown program

I posted this on SE and was pointed here. I also told to give more information however this is literally all I have. - Every now and then a random error message appears on my computer stating: "An attempt was made to load a program with an incorrect format. (Exception [...] read more
windows
0votes
0answers

Dotnet 5.0 project referencing 64bit dll runs locally but elsewhere throws "An attempt was made to load a program with an incorrect format."

I am referencing a third party dll that has both x64 and x86 versions. I am using the x64 version. There are no build warnings about mismatched bitness. This project runs fine from Visual Studio and running the .exe from the build folder on my local Windows 10 x64 machine, [...] read more
dll
64-bit
.net-5
0votes
0answers

CefSharp Core Runtime dll incorrect format

I am getting System.IO.FileNotFoundException: 'Could not load file or assembly 'CefSharp.Core.Runtime, Version=89.0.170.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138'. The system cannot find the file specified.' the file is there and in the bin directory along with the other dlls. Project set up: Console app targeting netcore 3.1 consumes a class library targeting netstandard 2.0 [...] read more
c#
cefsharp
cefsharp.offscreen
0votes
1answer

CefSharp.OffScreen.NETCore with Azure Function

I am trying to create an Azure function, which takes an url and then returns a screenshot of the page. I have added the package CefSharp.OffScreen.NETCore to the project and the code from CefSharp.MinimalExample for generating a screenshot. Running this in a simple Core console application works as intended, but [...] read more
azure-functions
cefsharp
cefsharp.offscreen
0votes
0answers

System.BadImageFormatException on running ServiceStack AutoQuery

The Project is running on asp.netcore 3.1.0. I encountered the exception System.BadImageFormatException at ServiceStack.ServiceStackHost. I just can't get AutoQuery working. the stack trace is below System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B) at ServiceStack.ServiceStackHost.OnStartupException(Exception ex) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServiceStackHost.cs:line 673 at ServiceStack.ServiceStackHost.RunPostInitPlugin(Object instance) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServiceStackHost.cs:line [...] read more
asp.net-core
ormlite-servicestack
0votes
0answers

.net core app failing to load custom assembly, bad IL Format

I try to load the custom library in my app, and I get a Bad IL Format error. Here is my code: var architectureFolder = (IntPtr.Size == 8) ? "64 bit" : "32 bit"; var wkHtmlToPdfPath = Path.Combine(_hostingEnvironment.ContentRootPath, $"wkhtmltox\\v0.12.4\\{architectureFolder}\\libwkhtmltox.dll"); AssemblyLoadContext context = new AssemblyLoadContext(GetType().Assembly.GetName().Name); context.LoadFromAssemblyPath(wkHtmlToPdfPath); Error details: > System.BadImageFormatException HResult=0x8007000B [...] read more
c#
asp.net
asp.net-core
0votes
0answers

.Net WebService get error when using TransactionOption.RequiresNew

I have a WebService project using .Net Framework 2.0. I'm migrating to .Net Framework 4.7.2. Current source code is declaring WebMethod as below: import System.EnterpriseServices ... <WebMethod(TransactionOption:=TransactionOption.RequiresNew)> Public Function LoginUpdate(ByVal Lv_UserId As String) As String When it's execute SQL query, i receive an error: An attempt was made to load [...] read more
.net
transactions
0votes
0answers

Can i run 86x bit dll in anyCPU without problem .net vs 2008

I have dll working with 86bit applications , so when i build my application to anycpu it is crushing i need my target to be any cpu because it solved me some other issues , so the deadlock is that i need is .dll not crushing in target: AnyCpu.(consider that [...] read more
vb.net
visual-studio-2008
desktop-application
0votes
1answer

BizTalk - polling an Oracle database package

I need to poll an Oracle database in BizTalk. In the postPollStatement I need to add the package that has been created for me in the Oracle DB. Can anyone assist me with this? I have created the schema in Visual Studio, the port is created and I have configured [...] read more
oracle
package
integration
biztalk
polling
0votes
0answers

BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B)

I am using a .NET Core 3.1. When I run the project locally, it works fine when I publish it to my Windows Server (windows server 2016) I am getting the following errors: enter image description here [https://i.stack.imgur.com/PkfoZ.png] Here is my error log file: info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C [...] read more
asp.net-core-3.1
windows-server-2016
badimageformatexception
typeinitializationexception
0votes
1answer

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 if I even copied the dll to the right places. What I [...] read more
c#
shared-libraries
streaming
data-science
badimageformatexception
0votes
0answers

Visual Studio 2019 installer runs after extracting but closes after a few seconds

I have the vs_community__1463967417.1589547493.exe when I run it, I see it extracting and requests me to give admin permissions, I allow, and nothing happens but it just creates files in the Temp folder. Contents of the Temp folder: VSFaultInfo dd_bootstrapper_20200818220314.txt dd_vs_community__1463967417.1589547493_decompression_log.txt The VSFaultInfo is a folder by the way. Content [...] read more
windows
visual-studio
windows-7
visual-studio-2019
windows-7-x64
0votes
0answers

How to debug System.BadImageFormatException An attempt was made to load a program with an incorrect format?

I'm attempting to include a C++ lib/dll into a C# project using a CLI wrapper, but After I added to the C# project references I started to get the following: System.BadImageFormatException occurred HResult=0x8007000B Message=Could not load file or assembly 'Wrapper, Version=1.0.7558.26276, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt [...] read more
c#
c++
0votes
1answer

Creating an App Package through a windows application packaging project fails to copy a dll

I have a newly created (empty) .net core 3.1 WinForm project where I want to use CefSharp. The app in itself runs fine, but I cannot create an app package. I can create an app package if I do not add the CefSharp NuGet package, which makes me think there [...] read more
visual-studio
winforms
.net-core
msbuild
cefsharp
0votes
1answer

Error 0x8007000b: Failed to create the managed bootstrapper application

I hope you are doing alright :) So, I was doing some wix tutorials about Burn, Bootstrapper tool. I tried to build my own UI (following this tutorial) and when I wanted to run it, it crashed. I have included this to my AsseblyInfo.cs [assembly: BootstrapperApplication( typeof(CustomBootstrapperApplication))] This is my [...] read more
c#
user-interface
wix
bootstrapper
0votes
0answers

ClickOnce Installer for UWP and Winform App

I have 2 application 1. UWP App 2. Winform Desktop App I want to create single Click Once Installer for both application So I have added Windows Application Packaging Project. and Added referance of both application .exe file both are added. now i am going to create app Package and [...] read more
uwp
clickonce
0votes
1answer

Unhandled Exception: System.BadImageFormatException Exception from HRESULT: 0x8007000B

Published neoj using visual studio 2017 and got neoj.exe file under bin\Release\PublishOutput but while running the neoj.exe file it throws: > Unhandled Exception: System.BadImageFormatException An attempt was made to > load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) and window show as dotnet has stopped working. Anyone [...] read more
windows
visual-studio
neo4j
0votes
0answers

Using OpenSSL for encrytion in C#

I really need your help with OpenSSL! I have this code: echo "Generating license key.." echo "First sign the license" openssl dgst -sha256 - passin pass: "$RSA_ENCRYPT_PASSPHRASE" - sign "$PRIVATE_KEY" -out "$SIGNATURE" "$LICENSE_CONTENT" echo "Now, create a license package: license content + signature" tar - cvf "$LICENSE_PACKAGE" "$LICENSE_CONTENT" "$SIGNATURE" echo [...] read more
c#
openssl
0votes
1answer

Signing XML document with digital signatures exception

I have been following this MSDN example and when I try to compile it, it throws this exception: An attempt was made to load a program with an incorrect format. (0x8007000B) everything seems to work fine until it reaches xmlDoc.Load("test.xml"); part. I searched around for a while and can't find [...] read more
digital-signature
msdn
0votes
1answer

How to build and package UWP project with AppService?

I have an app composed of three projects: * UWP app * .NET Framework 4.7.2 console app (Full thrust App service) * Packaging They build just fine in VisualStudio in debug and release. When building using MsBuild 2019 v16.4.2 or publishing with Visual Studio, the two first projects build fine [...] read more
c#
uwp
0votes
0answers

How to install 32 bit library to 32 bit web application running on 64 bit machine?

I'm trying to install a library that calls a separate dll, so I have 2 dll files. Lets call them library.dll and dependency.dll respectively. If both are 32 bit I get the following error: Unable to load DLL 'dependency.dll': The specified module could not be found. If they are both [...] read more
asp.net
iis
0votes
1answer

How to create a new object in C# Hybridizer CUDA code

As mentioned in Hybridizer's documentation, you can't use the new x() method of instantiating an object in Hybridizer CUDA code. I tried to use this method, but it would give an error related to the use of typeof(x) [ERROR] : 0X6079 : EnrichMethodDependencyGraph failed for method System.Type -- Exception: System.NullReferenceException: [...] read more
c#
hybridizer
0votes
0answers

BadImage Exception in VS2017

I am getting error while running the program at VS2017 [C#]. While I am running at my local system it is running fine. No error I am getting. But when I am build the solution and put the solution at the Prod server I am getting error. My mainlogin page [...] read more
c#
oracle11g
0votes
1answer

PdfiumViewer Pdfium Exception - VS2017 Created Project must be .Net 4.0 and then upgrade to any higher versions

VS2017 ver 15.9.3 NuGet Packages PdfiumViewer version="2.13.0.0" PdfiumViewer.Native.x86_64.v8-xfa version="2018.4.8.256" TEST SCENARIO - LOAD PDF FILE WITH PDFIUMVIEWER 1. Create Project1: Target Framework = .Net Framework 4. Program runs successfully. 2. Change Project1 to any higher Framework - 4.5, 4.5, 4.6 ... 4.72 Program runs successfully 3. Create Project2: Target Framework [...] read more
c#
pdf
rendering
pdf-viewer
pdfium
0votes
1answer

Calling unmanaged 32bit DLL exception occuring only on one user's computer: BadImageFormatException (Exception from HRESULT: 0x8007000B)

Our application is C# .Net 4 and calls an unmanaged 32bit DLL. It's been working fine and runs many machines (mostly 64bit Windows 7). However, I recently encountered one particular user on whose machine the program traps with BadImageFormatException as soon as the call into the unmanaged DLL is made. [...] read more
dll
unmanaged
32-bit
hresult
badimageformatexception
0votes
1answer

Unable to load DLL 'libargon2.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Geting below error while calling service Message authentication failed. Service: https://dashboard-dev.onsolve.com/DashboardSTS/Service.svc/IWSTrust13/ Action: http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue ClientIdentity: ActivityId: SecurityTokenException: Unknown internal error. ---> DllNotFoundException: Unable to load DLL 'libargon2.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) If I manually add it in bin folder,tried both x86/64 .I am getting [...] read more
asp.net
wcf
dll
build
dllimport
0votes
0answers

LibGit2Sharp throwing exception in Azure App Service

I have a .NET 4.6 web app running in an Azure App Service in 64 bit. When I hit a controller that calls LibGit2Sharp, I get the following exception: [BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)] And this is the [...] read more
c#
azure
libgit2sharp
azure-web-app-service
azure-app-service-plans
0votes
2answers

Interoperability C # and NAV 2016

I'm around trying to create an interoperable dll written in C # for use in Microsoft NAV 2016, for the development of a fiscal printer driver. In my C # project I called to other functions dll (delivered by the company Bematech, in 32-bit and unmanaged). Calls to the functions [...] read more
c#-4.0
dll
interop
navision
dynamics-nav
0votes
0answers

c# dllimport an attempt was made to load a program with an incorrect format

I want import an external C++ DLL in my C# code. But my following code doesn't work... I build my C# with "Any CPU" and my C++ DLL is built in 32 bits. Here my C++ DLL function: extern "C" DWORD __stdcall ScanForIed(LPSTR lpstrHtmlIedTag, LPSTR lpStartIpAddress, DWORD iNbAddressesToScan, LPSTR lpSelectedAddress) [...] read more
c#
c++
dll
dllimport
0votes
0answers

Total Phase I2C

I am using C# .Net framework 4.5 XAML application. My XAML application calls a DLL that I then use to make a call to the Total Phasae I2C aardvark_net.dll, which I have a reference in my C# DLL to it. The aardvark_net.dll depends on the aardvark.dll being in the same [...] read more
c#
i2c
0votes
1answer

ImageResizer: System.BadImageFormatException is causing Web app crash despite being in try ... catch

A user uploaded a PNG file which looks as if it is corrupted in some way. But the biggest problem is that any time our system tries to thumbnail it the entire app pool crashes and restarts. I've tried it using a direct URL and using code inside a try [...] read more
png
imageresizer
0votes
1answer

Citrix wfapi/mfcom working example

I installed Wfapi SDK. All standard examples for Wfapi in VB and C work just fine but I wanted to wrap the dll to use it in C#. However the example from the official site VSSDKNET Wrapper converted into VS10 standard and compiled gives me the incorrect format HResult : [...] read more
c#
citrix
virtual-channel
0votes
1answer

Generate call to generic method in runtime

Goal: generate method like this in runtime: public void InsertOnSubmit<T>(IQueryable<T> q, T o) where T : class, new() { (q as Table<T>).InsertOnSubmit(o); } My current code for this is: var tb = mb.DefineType("DatabaseDataRepository"); // define & implement other methods, etc /* Define InsertOnSubmit<> method */ var insertOnSubmitMethod = tb.DefineMethod("InsertOnSubmit", MethodAttributes.Public [...] read more
c#
generics
reflection.emit
0votes
1answer

Problem instaling outlook add-in in Office 2013

I am developing an add-in for outlook that references other libraries. It is supposed to work in Office 2013 and 2016 but in 2013 it does not work. Showing the errors the only thing I found is this: LOG: This bind starts in default load context. LOG: Using application configuration [...] read more
outlook
outlook-addin
outlook-2013
0votes
1answer

Microsoft Dynamics NAV instance running after windows restart but not responding

I've got issue with Microsoft Dynamics NAV instance. We're restarting Windows server each night (I know that we probably shouldn't do it, but this is a separated topic and not the point of this question). After windows server starts, SQL and Dynamics Nav instances are starting. Sometimes (1-2 times per [...] read more
microsoft-dynamics
dynamics-nav
microsoft-dynamics-nav
0votes
3answers

Unable to Call Simple Custom Dll Import from C# Application

Update I have now run through the tutorial 3 times with the same results (Visual Studio/Windows is unable to recognise the DLL as a valid file). This must be an issue with my environment, as mike below ran through the tutorial and it worked fine. I did notice this in [...] read more
c#
c++
0votes
1answer

asp core project can't starting HTTP Error 502.5 - Process Failure IIS

I can't understand why this project don't start. It's logs don't give me normal explanation. I use asp core and have project version 1.0.1. I install .NET Core 1.1 Runtime & Hosting Bundle server because this latest version. I'm not be able to update project. Logg : info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0] User [...] read more
asp.net
iis
.net-core
0votes
0answers

Start Bass with UWP

I found an example of UWP visualizer in this link but after I choose the audio file from the FilePicker and the Bass should start it returns an error: Attempt to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B), when Bass should start. public async Task Play() [...] read more
c#
uwp
bass
0votes
0answers

Error signing Electron package using Code signing certificate

We exported .exe and followed process as defined here https://electronjs.org/docs/tutorial/windows-store-guide, after that I configured and used electron-windows-store to export .appx and sign that. We have purchased code signing certificate form Godaddy. I exported pfx s defined here https://au.godaddy.com/help/windows-install-codedriver-signing-certificate-and-create-pfx-file-2698?locale=en. Check my request for exporting appx signing that below. > > electron-windows-store [...] read more
electron
windows-store-apps
code-signing-certificate
0votes
1answer

BadImageFormatException 0x8007000B only on Windows Server 2012 R2

I have a ASP.NET 3.5 application that includes a 32-bit DLL. It works fine (and has for years) on Windows XP, 7 and 10. I am adding support for Windows 2012, 2012 R2 and 2016. It works on 2016, but does not work on 2012 R2. At the first call [...] read more
iis
windows-server-2012
0votes
1answer

Using mingW compiled dll in VS2017

this topic certainly doesn't look 'new' but after reading a number of posts, blogs and comments, I'm still none the wiser, and can't get my test application working. From an implementation point of view I must compile the dll with mingW (when other MSVC compilers are used, the error count [...] read more
c#
c++
visual-c++
mingw
dji-sdk
0votes
3answers

C++ DLL imported into a C# application

I am trying to do a basic C++ DLL in order to use it in C#.. the following classes are used: My cpp file #include "stdafx.h" #include "MathFuncsAssembly.h" namespace MathFuncs { double MyMathFuncs::Add(double a, double b) { return a + b; } double MyMathFuncs::Subtract(double a, double b) { return a [...] read more
c#
c++
visual-studio
visual-c++
0votes
1answer

The app manifest publisher name (CN={digits}) must match the subject name of the signing certificate (CN=anton)

error 0x8007000B: The app manifest publisher name (CN=563776A1-7D2D-4E8E-AFE2-XXXXXX) must match the subject name of the signing certificate (CN=anton). I have searched all over the web and I get answer such as "you have to make sure that the Publisher name (in the AppxManifest.xml file) is the same as the certificate's [...] read more
uwp
0votes
0answers

EMGU CV Invoke error in Image.... object....All Visual Studip project is any cpu targetting...chaging target no use

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) In Emgu.CV.Invoke....I am getting above error. My projects are configured with "Any CPU". I installed latest version of EMGUCV in nuget.... img = new Image<Bgr, byte>(bitmapImage); read more
c#
.net
c#-4.0
dll
emgucv
-1votes
0answers

Using native dlls in .Net Core 3.1

I have an application running on .net core 3.1. Also, I have a .Net standard 2.0 library which has reference of native dlls. Now, I need to add a reference of this .net standard library in .net core application. So, ultimately I will have to add the reference of native [...] read more
c++
.net-core
native
asp.net-core-3.1
.net-standard
-1votes
1answer

Running "dotnet --info" gives Unexpected Error: System.BadImageFormatException

I'm trying to get a .Net environment running, but most of my dotnet calls in cmd give me this error message: Unhandled exception. System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B) I can't event get "dotnet --info" to run without this error. Does anyone [...] read more
.net
cmd
sdk
-1votes
1answer

Connection error to Azure SQL Database when running .Net Core console app as Azure webjob

I have .Net Core console app that connects to Azure SQL database using entity framework. Every think works fine locally but when I created publish package using this command line > dotnet publish -c Release -r win-x64 --self-contained false Zipped it and upload it and used it in Azure webjob [...] read more
azure
.net-core
azure-sql-database
azure-webjobs
webjob
-2votes
0answers

What is causing these two application errors? (HRESULT: 0x8007000B) & Error creating the Web Proxy

My IT department is refusing to help me. At the very least I would like to know what is wrong so I can fix it. I am trying to use a web application by Deltek called Ajera to access my time sheets. I was previously able to access the application [...] read more
.net
proxy
hresult
-4votes
3answers

How to add DLL to GAC and embed with exe

I need the C# code to add the assemblies to the GAC. Does anybody know how to add DLLs to GAC using C#? EDIT: I am trying to load a dll using bytes in a window application. As some of the dll file loads properly in my application but when [...] read more
c#
asp.net
assemblies

Comments

Leave a comment

(plain text only)

Sources

  1. winerror.h from Windows SDK 10.0.14393.0
  2. https://github.com/dotnet/coreclr/blob/v1.1.0/src/inc/corerror.xml
  3. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0