drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Other
936 stars 167 forks source link

Problems when using package with the .NET Native Toolchain #414

Closed cmpalmer66 closed 6 months ago

cmpalmer66 commented 7 months ago

I'm using this package in a Xamarin.Forms solution that deploys on iOS, Android, and UWP).

The package works fine on iOS and Android, but I get runtime errors on UWP when I compile the app with the .NET Native toolchain, which is required for Windows Store apps.

The errors occur when loading other assemblies in the project, not the metadata-extractor assembly itself. If I remove the metadata-extractor package from the project, the errors go away. I don’t even have to invoke any metadata-extractor methods to trigger the errors - just adding the package reference seems to break the .NET Native compilation.

I’m not sure if this is a bug in the .NET Native toolchain or something that metadata-extractor is doing that .NET Native doesn’t support.

Is there a way to fix this issue or work around it? Thanks for your help.

drewnoakes commented 7 months ago

I'm not familiar with .NET Native so I don't have much insight here. Can you provide details of the errors you're seeing?

Note that we recently merged some changes for NativeAOT in #397, though that was mostly just adding a .NET 8 target and suppressing some incorrect warnings.

What version of the lib are you using? Have you tried 2.9.0-rc1? #397 is not in that RC, so I can push out RC2 if you like.

ahsanaman92 commented 6 months ago

I would vote yes for a rc2 build. I have a library here that targets net8.0 and is using 2.9.0-rc1 https://github.com/ahsanaman92/JpegXmpWritePluginMDE and would like to play around with NativeAOT bit.

drewnoakes commented 6 months ago

Thanks for the reminder — been busy at work lately. Thankfully automation makes pushing a release pretty easy. Here's RC2 with the NativeAOT changes: https://www.nuget.org/packages/MetadataExtractor/2.9.0-rc2

I'll close this issue for now, but if you see any problems using NativeAOT and MDE, please create a new issue and I'll see about fixing them prior to 2.9.0 going out. Thanks!