0xC0000054 / libheif-sharp

Provides .NET bindings for libheif.
https://0xc0000054.github.io/libheif-sharp/
GNU Lesser General Public License v3.0
61 stars 3 forks source link

Unable to load libheif on .Net Framework #5

Closed hieudole closed 3 years ago

hieudole commented 3 years ago

Hi,

I have an issue when HeifContext is being initiated in a .Net Framework 4.6.1 console app. An exception was thrown

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

StackTrace: " at LibHeifSharp.Interop.LibHeifNative.heif_get_version_number()\r\n at LibHeifSharp.LibHeifInfo.GetLibHeifVersionNumber()\r\n at System.Lazy1.CreateValue()\r\n at System.Lazy1.LazyInitValue()\r\n at System.Lazy`1.get_Value()\r\n at LibHeifSharp.LibHeifVersion.ThrowIfNotSupported()\r\n at LibHeifSharp.HeifContext..ctor()\r\n at NetFramework.Program.Main(String[] args) in C:\Github\libheif-sharp-samples\NetFramework\Program.cs:line 9"

I create another console app, but it's a .Net Core 3.1 app, and it works fine. I use the same libheif and libheif-sharp (v2.0.2) for both projects.

Do I need to configure .Net Framework app to make it work with libheif & libheif-sharp?

hieudole commented 3 years ago

The project should be set to x64 in order to load the dll correctly.