none
System.BadImageFormatException

    Question

  • Hi.

    I have a Visual Studio 2010, SP1 project.  Addresses a SQL CE 3.5 database.  Compiled with Target Platform x86.
    My program runs OK on two machines: Windows 10 Pro, 64-bit OS, x64-based processor.
    On a 3rd. machine (also Win 10 Pro, 64-bit OS, x64-based processor), it fails with the message:

    System.BadImageFormatException: An attempt was made to load a program with an incorrect format.

    I have also run my program on two old Win XP machines and a Windows 7 Home edition: everything OK.

    Any idea why the program does not run on just one machine?

    Tuesday, August 16, 2016 1:44 PM

Answers

  • Hi Gudni Sigurdsson,

    Since this problem just occurs on your third client machine when start the application, please check whether this machine has the same bit with previous machines. Because some application is compatible with 64 bit machine, and some compatible with 32 bit machine, which based on when you developing the application, you debug it in Any CPU, x86 or x64.

    Then please check the Windows Event Viewer to check whether there has more detailed error information logged, which can provide more useful information to help us find the reason for this issue.

    In addition, please make sure there doesn't have any other third part software running when your program start, such as antivirus, which often causes some issues when it not recognize your program.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, August 19, 2016 7:32 AM
    Moderator

All replies

  • HiGudni Sigurdsson ,

    Thank you for posting MSDN forum.

    Firstly, there are some clarification with you:

    1. what's the VS edition on the 3rd machine?

    If the VS versions are different, there might be some compatibility problems when opening the project.

    2. Did you install any third-party software or add-ins that could affect your VS running?

    Please restart your machine and disable anti-virus software and firewall and run your Visual Studio as administrator then try it again.

    Also try running Visual Studio in Safe mode to Check whether some add-ins and extensions affect it(devenv /safemode).

    If still no help. I think there might be something wrong with your Visual Studio installation.

    If after repairing, the issue still exists. I need you installation log file to troubleshoot this issue,

    please use http://aka.ms/vscollect to gather the installation logs. After using it, you will find vslogs.cab from %temp% folder. Please upload the file to  https://onedrive.live.com/and share the link here.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    Wednesday, August 17, 2016 5:37 AM
    Moderator
  • Hi Lana Xu.

    1.  The first machine is my development machine.  There, I use VS2010 with SP1.  My project is Windows Forms and I use C#.  This machine also has VS2013, but for this project I have to use VS2010 because of SQL CE.  My solution also includes a setup project, producing a msi file.  I carry this msi file to the various computers to set up my application.  When I run the setup on this first machine, everything is OK.

    The second machine (which I also use for development) has VS2008 and VS2013.  I do not develop this application on this machine.  I only use it to test run my app.  Here everything is OK.

    The third machine is my client´s machine.  It does not have Visual Studio installed.  Here, we run the setup and then start the application.  It is here where we encounter the error.  An earlier (14.01.2016) version of  my app runs perfectly on this computer.  We have reverted to this earlier version for the time being.  My client can´t afford to loose time in testing now.  That has to wait until October.

    2.  I can´t think of anything I have installed that should affect my VS running.  Also, as I have explained above, I only use VS for development of this project on the first machine.

    I thank you very much for taking time to look at my problem.  I will, of course, consider carefully any further suggestions on your part.

    Wednesday, August 17, 2016 8:43 AM
  • Hi Gudni Sigurdsson,

    Since this problem just occurs on your third client machine when start the application, please check whether this machine has the same bit with previous machines. Because some application is compatible with 64 bit machine, and some compatible with 32 bit machine, which based on when you developing the application, you debug it in Any CPU, x86 or x64.

    Then please check the Windows Event Viewer to check whether there has more detailed error information logged, which can provide more useful information to help us find the reason for this issue.

    In addition, please make sure there doesn't have any other third part software running when your program start, such as antivirus, which often causes some issues when it not recognize your program.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, August 19, 2016 7:32 AM
    Moderator
  • Hi Weiwei Cai.

    As I explained to Lana Xu, further testing on the client machine will have to be postponed until October.  Then, I will certainly follow your advice.

    Friday, August 19, 2016 8:08 AM