HDFGroup / HDFGroup/HDF.PInvoke.1.10

Unhandled exception. System.TypeInitializationException: The type initializer for 'HDF.PInvoke.H5T' threw an exception.

Open
#21 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
7
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am trying to use this library to read and write data from HDF5 files. I am able to read data from a HDF5 file but when I try to save a HDF5 file I get this error:

```
Unhandled exception. System.TypeInitializationException: The type initializer for 'HDF.PInvoke.H5T' threw an exception.
---> System.TypeInitializationException: The type initializer for 'HDF.PInvoke.H5DLLImporter' threw an exception.
---> System.IO.FileNotFoundException: libhdf5.dylib
at HDF.PInvoke.H5MacDllImporter..ctor(String libName) in /home/appveyor/projects/hdf-pinvoke-1-10/src/HDF.PInvoke.1.10/H5DLLImporter.cs:line 213
at HDF.PInvoke.H5DLLImporter..cctor() in /home/appveyor/projects/hdf-pinvoke-1-10/src/HDF.PInvoke.1.10/H5DLLImporter.cs:line 70
--- End of inner exception stack trace ---
at HDF.PInvoke.H5T..cctor() in /home/appveyor/projects/hdf-pinvoke-1-10/submodules/HDF.PInvoke/HDF5/H5Tglobals.cs:line 38
--- End of inner exception stack trace ---
at HDF.PInvoke.H5T.get_NATIVE_INT32() in /home/appveyor/projects/hdf-pinvoke-1-10/submodules/HDF.PInvoke/HDF5/H5Tglobals.cs:line 332
at HNSW.Net.Demo.Hdf5Utils.GetDatatype(Type type) in /Users/siddjain/github/hnsw-sharp-demo/Hdf5Utils.cs:line 153
at HNSW.Net.Demo.Hdf5Utils.WriteDataset[T](Int64 fileId, String dataset, T[] data, UInt64[] dimensions) in /Users/siddjain/github/hnsw-sharp-demo/Hdf5Utils.cs:line 193
at HNSW.Net.Demo.Program.Main() in /Users/siddjain/github/hnsw-sharp-demo/Program.cs:line 87
```

Its strange because while reading from HDF5 file I don't get any `System.IO.FileNotFoundException: libhdf5.dylib` exception.

The full code for the Hdf5Utils.cs class in the stacktrace can be seen here: https://github.com/siddhsql/hnsw-sharp-demo/blob/main/Hdf5Utils.cs

In addition I set `DYLD_LIBRARY_PATH` equal to the location where the `libhdf5.dylib` can be found. I am running on Mac os.

```
$ ls -al /opt/homebrew/lib/libhdf5.dylib
lrwxr-xr-x@ 1 siddjain admin 39 Jul 10 17:34 /opt/homebrew/lib/libhdf5.dylib -> ../Cellar/hdf5/1.14.1/lib/libhdf5.dylib
```

I am using below version of the library:

```

```

Below are actual screenshots if it helps:

Pasted Graphic 1

Pasted Graphic 2

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.