none
.NET 2.0 BUG: BadImageFormatException exception RRS feed

  • Question

  • Hello,

    I've run into this bug described at the following link.

     http://support.microsoft.com/kb/940164

    Does anyone know how to find out if this has been fixed, and if so, how to get the fix?  I installed a windows update for .net 3.0, and that appears to have resolved the problem, but I'm a but confused because the bug is about .net 2.0.  I would like to verify that when I deploy my application to customers, I install the correct updates.

    Thank you!
    Thursday, July 3, 2008 2:00 PM

Answers

  • The actual question is are you getting BadImageFormatException because of a bug or you are using both x86 which is 32bits and x64 which 64bits together without taking care of dependent dlls?

    The above exception comes more from mixing 32bits and 64bits in same application than any other development situation.  I solve one such problem at least once a month at the 64bits forum. 


    Asp.net MVP, MCPD Web C#, MCITP BI & MCTS SQL Server 2005
    • Marked as answer by Figo Fei Monday, July 7, 2008 3:56 AM
    Friday, July 4, 2008 9:27 PM
    Moderator

All replies

  • The actual question is are you getting BadImageFormatException because of a bug or you are using both x86 which is 32bits and x64 which 64bits together without taking care of dependent dlls?

    The above exception comes more from mixing 32bits and 64bits in same application than any other development situation.  I solve one such problem at least once a month at the 64bits forum. 


    Asp.net MVP, MCPD Web C#, MCITP BI & MCTS SQL Server 2005
    • Marked as answer by Figo Fei Monday, July 7, 2008 3:56 AM
    Friday, July 4, 2008 9:27 PM
    Moderator
  •   Thanks for the suggestion, but I have investigated that problem and I am very sure that is not happening.  I used corflags to look at all of my dlls and confirm that all of them have been built with ANY CPU, and I am running on a 32-bit machine.

    I can initially load the offending class, because a breakpoint in its static constructor is hit.  The exception happens when I try to call a method in the same class.  You can see this by running the sample code from the link I posed (unless you have the latest update for .net, in which this bug is fixed.)

    I know for sure the bug is fixed after I updated, but I just wanted to confirm this bug has been 'officially' released, so I can feel safe about releasing my code to clients.

    Thanks.
    Monday, July 7, 2008 12:15 PM
  • This is not just what you are developing it could be a connection to a database that is 64bits or building AnyCPU when using Access or Excel because with both you must build x86 which is 32bits because the Jet engine is only 32bits.

    If you did not write everything your application uses that is the place to check for reasons for BadImageFormatException.


    Asp.net MVP, MCPD Web C#, MCITP BI & MCTS SQL Server 2005
    Monday, July 7, 2008 12:34 PM
    Moderator