When running or debugging VMware GemFire Native Client C# Application, you may meet the below exception:
System.BadImageFormatException: 'Could not load file or assembly 'Pivotal.GemFire, Version=10.0.3.2, Culture=neutral, PublicKeyToken=126e6338d9f55e0c' or one of its dependencies. An attempt was made to load a program with an incorrect format.’
This exception is thrown when the file format of a dynamic link library (.dll
file) or an executable (.exe
file) doesn't conform to the format that the common language runtime expects.
Since VMware GemFire Native Client 10.x only provides a 64-bit dll file (Pivotal.GemFire.dll
) for the C# application and the default target platform in Visual Studio is "x86
" or “AnyCPU
”, the exception is thrown under the following condition with the utmost probability:
Visual Studio 2017 Menu [Build] -->[Configuration Manager...] -->[Active Solution Platform] -->Choose [x64], if there is no x64 so far then create a new one as x64 by [<New...>]