I have a ASP.NET Core project that uses the Word -> PDF converter. I'm basically using identical code to the example on Syncfusion's website (link). Also, running the latest version of Visual Studio Code for debugging.
If I debug my project on a Windows 10 machine, everything works fine. But, if I debug the exact same code on VS Code on an M1 Macbook Pro, I get the following error when I hit this line of code:
PdfDocument pdf = render.ConvertToPDF(wordDoc);
The error is: "The type initializer for 'SkiaSharp.SKImageInfo' threw an exception".
Now, i don't have SkiaSharp as a package in this project. But when I added it and included it in the @using SkiaSharp; in my code, I still get the same error.
I'm sure this is some sort of Mac/ARM/Unix issue because it works fine everywhere else. Any help at what I'm missing?
Thanks!!!
More Error Details:
Data [IDictionary]:{System.Collections.ListDictionaryInternal}
HResult [int]:-2146233036
HelpLink [string]:null
InnerException [Exception]:{System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibSkiaSharp, 0x0001): tried: 'liblibSkiaSharp' (no such file), '/usr/local/lib/liblibSkiaSharp' (no such file), '/usr/lib/liblibSkiaSharp' (no such file), '/Users/[REDACTED]/Documents/Websites/TestSite/liblibSkiaSharp' (no such file), '/usr/local/lib/liblibSkiaSharp' (no such file), '/usr/lib/liblibSkiaSharp' (no such file)
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()}
Message [string]:"The type initializer for 'SkiaSharp.SKImageInfo' threw an exception."
Source [string]:"Syncfusion.SkiaSharpHelper.Portable"
StackTrace [string]:" at Syncfusion.Drawing.SkiaSharpHelper.Image..ctor(Int32 width, Int32 height)\n at Syncfusion.Drawing.SkiaSharpHelper.Bitmap..ctor(Int32 width, Int32 height)\n at Syncfusion.DocIORenderer.RenderHelper.GetBitmap(Int32 width, Int32 height)\n at Syncfusion.DocIO.Rendering.DrawingContext.CreateBitmap(Int32 width, Int32 height)\n at Syncfusion.DocIO.Rendering.DrawingContext..ctor()\n at Syncfusion.DocIORenderer.DocIORenderer.ConvertToPDF(WordDocument wordDocument)\n at ShowbizJobs.Controllers.AccountController.<Resumes>d__52.MoveNext() in /Users/[REDACTED]/Documents/Websites/TestSite/Controllers/AccountController.cs:line 1026"
TargetSite [MethodBase]:{Void .ctor(Int32, Int32)}
TypeName [string]:"SkiaSharp.SKImageInfo"
Static members
Non-Public members
I have the same issue. Here are the libraries i have installed...
Hi,
I'm on a M1 Mac using .NET 6 in arm64 and getting the same issue here too.
Okie doke, for those that need help. I got this working. I had to use the pre-release version of SkiaSharp.NativeAssets.Linux and HarfBuzzSharp.NativeAssets.macOS (it only exists in pre-release). Could Syncfusion possibly update the documentation, as it makes zero mention of macOS at all, and of course .NET has existed on macOS for a while now.
https://www.nuget.org/packages/HarfBuzzSharp.NativeAssets.macOS/2.8.2-preview.187
https://www.nuget.org/packages/SkiaSharp.NativeAssets.Linux/2.88.0-preview.187
I hope that helps!