Friday, March 20, 2015

windows 10 - How to fix BadImageFormatException on application startup?

I bought the game Stardew Valley on steam, installed it, launched it. Nothing happened :(...
When I took a look in the eventviewer I saw the following information:


Application: Stardew Valley.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.BadImageFormatException at
StardewValley.Program.Main(System.String[])

To me this sounds like a bad dll or a wrong architecture for a dll, but I haven't been able to sort out what the problem is.
Right after that:


Faulting application name: Stardew Valley.exe, version: 1.0.5940.30711, time stamp: 0x5705b1ef
Faulting module name: KERNELBASE.dll, version: 10.0.10586.162, time stamp: 0x56cd55ab
Exception code: 0xe0434352
Fault offset: 0x000bdad8
Faulting process id: 0x23d8
Faulting application start time: 0x01d19eee1ec0b80d
Faulting application path: F:\Steam\steamapps\common\Stardew Valley\Stardew Valley.exe
Faulting module path: C:\WINDOWS\SYSTEM32\KERNELBASE.dll
Report Id: b8cdbcca-597d-4eb4-a44c-47f2b8c510a5
Faulting package full name:
Faulting package-relative application ID:

Followed by:


Fault bucket 108078241334, type 1
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: Stardew Valley.exe
P2: 1.0.5940.30711
P3: 5705b1ef
P4: KERNELBASE.dll
P5: 10.0.10586.162
P6: 56cd55ab
P7: e0434352
P8: 000bdad8
P9:
P10:

I like to fix my own problems, but after 6 hours I give up. I used Dependency Walker to inform me about missing dll's or incompatible versions. One of the strange things is that the game exe is x86 and all loaded dll's are x64. My wife also has the game and it works on her machine, however Dependency Walker reported no big differences. She only got a few more dll's available (which I copied afterwards, but didn't help).


Here is what I tried (with reboots in between):



  • Reinstall game (3 times)

  • Reboot

  • Steam file integrity check

  • Start outside steam

  • Start as administrator

  • All compatibility modes

  • Reinstalling XNA 4.0

  • Completely removed XNA 4.0 and reinstall

  • sfc /scannow

  • dism /Online /Cleanup-Image /RestoreHealth

  • Installing on game on C drive instead of F drive

  • Complete removal of all System32/d2*.dll and d3*.dll and reinstalling directx (Which broke a few other games)

  • Updated graphic drivers

  • dxdiag reports no problems

  • shut down and turning on again

  • placing the following (missing) dll's in the system32/syswow64/game directory

    • (x86)API-MS-WIN-CORE-APIQUERY-L1-1-0.DLL

    • (x86)API-MS-WIN-CORE-APPCOMPAT-L1-1-1.DLL

    • (x86)API-MS-WIN-CORE-FIBERS-L1-1-1.DLL

    • (x86)API-MS-WIN-CORE-FIBERS-L2-1-1.DLL

    • (x86)API-MS-WIN-CORE-PSM-APPNOTIFY-L1-1-0.DLL

    • (x86)API-MS-WIN-DEVICES-CONFIG-L1-1-1.DLL

    • (x86)API-MS-WIN-MM-MISC-L1-1-1.DLL

    • (x86)API-MS-WIN-RTCORE-NTUSER-WINEVENT-L1-1-0.DLL

    • (x86)API-MS-WIN-SECURITY-CRYPTOAPI-L1-1-0.DLL

    • (x86)EXT-MS-WIN-RTCORE-NTUSER-DPI-L1-1-0.DLL

    • (x86)IESHIMS.DLL

    • (x64)API-MS-WIN-BASE-UTIL-L1-1-0.DLL

    • (x64)API-MS-WIN-CORE-COMM-L1-1-0.DLL



I decompiled the exe to look at its references, which are:



  • Lidgren.Network

  • Microsoft.Xna.Framework

  • Microsoft.Xna.Framework.Game

  • Microsoft.Xna.Framework.Graphics

  • Microsoft.Xna.Framework.Xact

  • mscorlib

  • PresentationCore

  • Steamworks.NET

  • System

  • System.Core

  • System.ServiceModel

  • System.Windows.Forms

  • System.Xml

  • xTile


All these dll's were succesfully resolved.
What more can I do to try to fix this issue? I will reinstall my system in two months from now, which might help, but I think it is too radical to do it now for the sake of 1 program that refuses to launch.


EDIT:
Here is a crash dump which will expire on 27-04-2016.


I also looked into the crash dump and tried to debug it with Visual Studio 2015. I'm getting the following error:
An unhandled exception of type 'System.BadImageFormatException' occurred in Unknown Module.


Additional information: Could not load file or assembly 'Microsoft.Xna.Framework.dll' or one of its dependencies.  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
If there is a handler for this exception, the program may be safely continued.

I do not understand this error. I already reinstalled it twice!
However, when I search for the dll, I find multiple version located at the following places:



  • C:\Program Files (x86)\Microsoft Silverlight\5.1.41212.0

  • C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\MDILXAPCompile\Framework

  • C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.1

  • C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\MdilXapCompilev8.0\Framework

  • C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0

  • C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86

  • C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Xbox360

  • C:\Windows\Microsoft.NET\assembly\GAC_32\Microsoft.Xna.Framework\v4.0_4.0.0.0__842cf8be1de50553


When I look at the references with DotPeek it says it takes this one: C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.dll (which exists).

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...