1. This forum is archived for reference. For support & bug reports visit the help section of forums.stardewvalley.net

Bug/Issue [SMAPI V3.5.0 ERROR] SMAPI Failed to Initialize: System.BadImageFormatException

Discussion in 'Support' started by Wolfzst, May 29, 2020.

  1. Wolfzst

    Wolfzst Space Hobo

    Hi, I'm new to the forum, how are you? but I find myself posting because I have a little problem. First of all I am sorry to bother, and I also think it is very hypocritical of me to ask for help, for reasons that I will explain later. At the moment I'm going straight to the point

    I am currently having a very common error with SMAPI v3.5.0 for Stardew Valley 1.4.5 the problem is the follows: SMAPI Failed to Initialize: System.BadImageFormatException: Could not load file or assembly 'Stardew Valley' or one of its dependencies. The Module was expected to contain an assembly manifest.

    Here An Image:
    [​IMG]


    I understand that this problem may be because; To be honest, I currently own a cracked copy of the game, that is to say a pirated copy because I don't have the money to buy the original version of steam at the moment (For Third World Reasons), but that's not important.

    I have tried all the solutions that have been offered so far to fix the error:
    Reinstall Dependencies
    - Microsoft XNA Framework
    - Microsoft Visual C ++ Redistributable Package 2010 (x64) and (x86)
    - Microsoft .NET Framework 4.5.2
    Reinstall SMAPI
    Delete and re-download the Game (Pirate)

    But none of these methods has worked for me. Also note that the methods I used have been repeated at least 7 or 8 times, and I have been trying to fix it myself for weeks, but it is impossible for me without a hand.

    And now here comes the real problem.
    As I explained, I have a pirated copy and many of you may say "If you have a pirated copy it is natural that you have that error" But the reality could not be more different, I have tried on another computer exactly the same version (pirated) and the The first time it worked correctly, and so far it continues to work on that computer. I have about 20 Mods and all working properly together with SMAPI. I also remember that I have not copied any of the files from that computer for this one, I have installed the entire Game from 0 and of course the SMAPI.

    That is why this problem seems extremely rare to me and I have not found a specific solution, so I would like to ask for your help.

    I will explain other conditions, relatively few days ago I formatted my whole computer (including drivers and others, although SMAPI still did not work in this one) for some cleaning and security issues. Currently the Operating System is still W7 and soon I plan to change it to W10, but at the moment I want to have a solution to play this game, While trying to save to get the W10 version. And in turn to get the paid version of Stardew Valley steam. It should also be noted that the other computer also has the Windows 7 operating system.

    That is why I find myself publishing this in order to ask for help or at the very least, some suggestions to see how I solve this problem. All help is appreciated, regardless of how little it is.

    If someone can tell me if this is because I format my pc and I need to install some separate drivers, please tell me which ones are necessary, or if so, if it is because the computer does not have all the updates required for the game to work with mods (Currently there are about 96 Updates that I needed for the Operating System, although recently I just installed the 96 updates), Here I will make a parenthesis: "The base game without modifications works and opens properly, but when I try to open the SMAPI the previously displayed error. " So maybe it can also be some kind of "Safe" of SMAPI, so that it is not used in pirated copies, or at least I can guess, however this assumption goes to waste when I remember that on the other computer it works SMAPI correctly in a pirated version.

    With this said, I again apologize for the inconvenience and thank you in advance for those who can help me. I send a greeting.
     
    • windsorperma

      windsorperma Space Hobo

      The exception that is thrown when the file image of a dynamic link library (DLL) or an executable program is invalid. If you get a BadImageFormatException when interfacing with a native DLL, it almost always means that you are trying to interface with a 32-bit DLL while running in the 64-bit CLR, or vice versa. In most cases you might be facing the problem with your website after deploying on server.

      Make sure that you are not having 32-bit / 64-bit conflict. So, you need to adjust your application pool to Enable 32-Bit or 64-Bit accordingly. Set the Target platform setting on your c# EXE project, not your class library project. Alternatively, you can ship both 32-bit and 64-bit DLLs with different file names, define separate P/Invoke stubs for each version, and decide which one to call at runtime. The easiest way to do this would probably be to wrap your native calls in an interface (e.g., INativeMethods) and choose which implementation to instantiate at runtime based on IntPtr.Size. With this method, you could still target AnyCPU.
       

      Share This Page