Hello,
We've been using Infragistics WinForms controls for many years and there's been one issue we haven't been able to solve after many version upgrades. When one of our WinForms applications is running and the user's PC locks up (unrelated to our application) and needs to be powered off, after the system is rebooted there is often an Infragistics DLL that has the first section zeroed out. In other words, the DLL file itself has had the first initial bytes replaced with all zeros. When the user then attempts to start the application they get an error similar to the following:
System.BadImageFormatException: Could not load file or assembly 'Infragistics4.Win.UltraWinStatusBar.v18.2, Version=18.2.20182.175, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' or one of its dependencies. The module was expected to contain an assembly manifest. File name: 'Infragistics4.Win.UltraWinStatusBar.v18.2, Version=18.2.20182.175, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb'
The affected DLL is not always UltraWinStatusBar; it can be UltraWinGrid, UltraWinToolbars, or the Win DLL (Infragistics4.Win.v18.2). The size and timestamp of the file are unchanged. I'm guessing the part of the file that gets zeroed out is the part that contains the assembly manifest.
The only solution is to re-copy the DLL from another source. Any suggestions you can offer would be greatly appreciated.
Hello Cavin,
Are you getting this error on all the machines? May I know which version of visual studio and .net framework you are using ?
I never heard of this scenario/issue before, I did some research about the System.BadImageFormatException and find couple public post talking about corrupted .NET framework versions. I would recommend running a repair or a reinstall of the .Net Framework from Add/Remove Programs.
Another common source of BadImageFormatException is the bit-ness. By default, .NET uses AnyCPU nowadays, which means it will use 64-bit if available, and 32-bit otherwise. It's possible that one of the projects uses 32-bit while the other uses 64-bit,
https://stackoverflow.com/questions/31344410/system-badimageformatexception-using-net-2-0
If this will not help then please provide the clear steps, you environment and I will try to reproduce the issue at our environment for further investigation.
Hi Divya,
Thanks for the reply. This issue has occurred on many different PCs (Windows 7 and Windows 10) and has stretched back at least 6 years across various versions of .NET Framework (3.5 to 4.5 to 4.7.2), Visual Studio (2015 to 2017 to 2022), and Infragistics (10.2 to 16.1 to 18.2).
But your questions made me review error logs from the past several years and in doing so I discovered that the issue occasionally affects our own DLLs as well, so this is not an Infragistics issue as I initially expected. As such my post can be disregarded.
Thanks again for your quick response.