none
App crashes on Server 2012, depending on how it's built. RRS feed

  • Question

  • We have an application compiled using Visual Studio 2010 using .net 4 which parses some data files and writes the data to SQL Server. It's currently using .net 4, but was originally .net 1.0 (or 1.1, the early history's hard to get at since we've changed version control systems in the past decade).

    In any case, we recently upgraded the server that it runs on to Windows 2012, and it's stopped working, giving a System.BadImageFormat exception. The same executable works fine on 64 bit Windows 7. To make life even more fun, if I build it from the IDE, I get a good binary. If I try to build it using our build script (which calls devenv /batch), I get something that 2012 hates.

    Looking at the binaries, it looks like there's a slight difference in code size. using the PE File Explorer. ILSpy thinks that the exes are functionally identical.

    Does anybody have a clue what the heck is going on? I have a work around, so I'm not planning on digging further into the binaries, but it's still disconcerting to have the current Windows Server occasionally hating "good" executables.


    Mike Swaim

    Wednesday, August 5, 2015 7:41 PM

Answers

  • On the other hand, marking the EXE as x86 in its project properties and building release|x86 works. (And you have to do both.)


    Mike Swaim


    • Marked as answer by mpswaim Tuesday, August 18, 2015 5:59 PM
    • Edited by mpswaim Tuesday, August 18, 2015 5:59 PM
    Tuesday, August 18, 2015 5:59 PM

All replies

  • I'm not sure that answers my question. (I don't think that their question was answered, either.) I guess that it could be rephrased as "why do some 4.0 apps not run under 4.5, depending on how they were built." Thanks for the article, though. It may have provided a clue as to what's going on.

    Mike Swaim

    Thursday, August 6, 2015 12:11 PM
  • Hi Mike,

    Is it possible to post your work around here, it will help other community members who have the same issue.

    >> Does anybody have a clue what the heck is going on?

    If you need more assistant to know more about this problem, please send a repro project for troubleshooting.

    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.

    Monday, August 10, 2015 3:24 AM
    Moderator
  • Is it possible to post your work around here, it will help other community members who have the same issue.

    The work around is to build the project from the IDE. It makes automated deployments a no-go, but we rarely change this app. If I zipped up the project and build script, where would I send it?


    Mike Swaim

    Tuesday, August 11, 2015 12:52 PM
  • Is it possible to post your work around here, it will help other community members who have the same issue.

    The work around is to build the project from the IDE. It makes automated deployments a no-go, but we rarely change this app. If I zipped up the project and build script, where would I send it?


    Mike Swaim

    Upload main code snippet using code block in edit box.

    Thanks for your time.


    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 12, 2015 1:20 AM
    Moderator
  • As a data point, building Release|x86 to force a 32 build of all components doesn't work, either.

    Mike Swaim

    Tuesday, August 18, 2015 1:08 PM
  • Our build script's too big to fit in the edit box. Here's the appropriate snippet.

    # Some banner info
                    $sMsg = "Starting Devenv.exe to build " + $mySlnToBuild   + " (config: " + $sConfig + ")`n"

                    $sPathErrors = "";
                    $sVSPathPlusFileName = "";
                    FindVisualStudioExe $mySlnToBuild  ([ref]$sVSPathPlusFileName) ([ref]$sPathErrors)
                    if( $sPathErrors.length -gt 1)
                    {
                      write-host "`nThe path for VS.NET could not be determined. ($sPathErrors)"  -foregroundcolor red
                      exit;
                    }
                    write-host "`nThe path for VS.NET is:`n  "  $sVSPathPlusFileName


                    write-progress "Building the Solution..." $sMsg
                    write-host     "`n--> Building the Solution...`n" $sMsg   -foregroundcolor darkgreen

                    # Start Microsoft VisualStudio, build our Solution file:
                    # (Pipe to out-null so the script will wait, and capture $LASTEXITCODE)
                    #devenv.exe  $mySlnToBuild  /Build  $sConfig  /out $myLogFile   | out-null

                    &($sVSPathPlusFileName)   $mySlnToBuild  /Build  $sConfig  /out $myLogFile /log ($myLogFile+".xml")  | out-null

                    $sCommandLine = "/Build  $sConfig  /out $myLogFile "      # Note variable expansion in the string.


                    if ($LASTEXITCODE -ne 0)
                    {
                       write-host "`nThe build using DevEnv.exe returned:" $LASTEXITCODE   -foregroundcolor red
                       write-host "`nThis is NOT a success code !!! "                        # But keep processing this script
                       write-host "Please inspect the log file: " $myLogFile "`n"            # But keep processing this script
                    }
                    else
                    {
                       $outputFolder =  $myBuildBitsOutputFolder -creplace '\$\(ConfigToBuild\)', $sConfig
                       write-host "The Build output should now be in:`n  "  $outputFolder  "`n"   -foregroundcolor darkgreen
                    }
               }  # foreach $conf


    Mike Swaim

    Tuesday, August 18, 2015 1:13 PM
  • On the other hand, marking the EXE as x86 in its project properties and building release|x86 works. (And you have to do both.)


    Mike Swaim


    • Marked as answer by mpswaim Tuesday, August 18, 2015 5:59 PM
    • Edited by mpswaim Tuesday, August 18, 2015 5:59 PM
    Tuesday, August 18, 2015 5:59 PM