HDF.PInvoke icon indicating copy to clipboard operation
HDF.PInvoke copied to clipboard

H5F.create() call throws BadImageFormatException

Open abrasat opened this issue 7 years ago • 1 comments

A VS 2017 console application (.NET 4.6.1 as target framework) running on a Windows 10 x64 PC throws following exception at call of the H5F.create(@"C:\mytest.h5", H5F.ACC_TRUN) method, if application built with the AnyCPU (or x86) option as platform target:

BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

It seems to work ok if application built with x64 as platform target. Is this a normal behaviour?

Later edit: I tested my application also with HDF.PInvoke.NETStandard library instead of HDF.PInvoke. It has the same behaviour for AnyCPU, but it works with x86 (and x64).

abrasat avatar Jun 08 '18 08:06 abrasat

In my case H5F.create() resulted in the following error. 'H5P.FILE_ACCESS' threw an exception of type 'System.TypeInitializationException' The inner exception shows "The type initializer for 'HDF.PInvoke.H5DLLImporter' threw an exception.". I believe the issue is coming from the function GetHid. I am not sure how to address this.

raghu-iitm avatar Jul 06 '18 06:07 raghu-iitm