HDFGroup / HDF.PInvoke

Raw HDF5 Power for .NET
http://www.hdfgroup.org/HDF5
Other
80 stars 29 forks source link

H5F.create() call throws BadImageFormatException #144

Open abrasat opened 6 years ago

abrasat commented 6 years ago

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).

raghu-iitm commented 6 years ago

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.