Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadImageFormatException on x64 #29

Open
pranavsharma opened this issue Feb 26, 2019 · 1 comment
Open

BadImageFormatException on x64 #29

pranavsharma opened this issue Feb 26, 2019 · 1 comment

Comments

@pranavsharma
Copy link

pranavsharma commented Feb 26, 2019

Compiled with VS2017 15.9.3 Enterprise edition using x64/AnyCPU.
Registered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\DIA SDK\bin\amd64\msdia140.dll". When I run the exe, it throws an error:

PS C:\Users\foobar\work_projects\SymbolSort> C:\Users\foobar\work_projects\SymbolSort\bin\Release\SymbolSort.exe -in C:\Users\foobar\work_projects\someproduct\build\Windows\RelWithDebInfo\RelWithDebInfo\someproduct.pdb -out symbol_sort.txt

Loading symbols from C:\Users\foobar\work_projects\someproduct\build\Windows\RelWithDebInfo\RelWithDebInfo\someproduct.pdb

Unhandled Exception: System.BadImageFormatException: Retrieving the COM class factory for component with CLSID {761D3BCD-1304-41D5-94E8-EAC54E4AC172} failed due to the following error: 800700c1  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1).
   at SymbolSort.SymbolSort.ReadSymbolsFromPDB(List`1 symbolsOutput, String filename, String searchPath, UserFlags options) in C:\Users\foobar\work_projects\SymbolSort\SymbolSort.cs:line 1181
   at SymbolSort.SymbolSort.LoadSymbols(InputFile inputFile, List`1 symbols, String searchPath, UserFlags options) in C:\Users\foobar\work_projects\SymbolSort\SymbolSort.cs:line 1550
   at SymbolSort.SymbolSort.Main(String[] args) in C:\Users\foobar\work_projects\SymbolSort\SymbolSort.cs:line 0

@skottmckay
Copy link

Did you add a reference to the dll?

In order to get the msdia140 interop to work you must add msdia140.dll as a reference to the C# project. That is done either by dragging and dropping the dll onto the references folder in the C# project or by right clicking the references folder, selecting "Add Reference" and then browsing for the msdia140 dll.

That fixed this error for me but led to another one:

Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {E6756135-1E65-4D17-8576-610761398C3C} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

You also need to register the non-platform specific msdia140.dll in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\DIA SDK\bin\msdia140.dll" to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants