Open MohanaselvamJ opened 4 weeks ago
Hi! Any updates on this? I am getting the same.
You are loading the managed (.NET) dlls, but have not made sure the native parts are able to be found. You can't reference them directly via the CLR, but if they are in the same folder as the managed dlls, they should be found: https://www.nuget.org/packages/SkiaSharp.NativeAssets.Win32
I think all of this will work if you publish your .NET app and then use that. Publishing will copy all references and dependencies into the output. You can then load the dlls, and they should find the native libraries.
@mattleibow , We are still getting the exception after including the native libSkiaSharp.dll.
`PS D:\Word-to-PDF-Python\Word-to-PDF-Python\API files in Python> python SkiaSharpSample.py Checking path Fail to load System.DllNotFoundException: Unable to load DLL 'libSkiaSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at SkiaSharp.SkiaApi.sk_colortype_get_default_8888() at SkiaSharp.SKImageInfo..cctor()
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Word-to-PDF-Python\Word-to-PDF-Python\API files in Python\SkiaSharpSample.py", line 36, in
print("Open and Save status: "+str(docIO.SkiaSharpSample()))
System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()
--- End of inner exception stack trace ---
at DocIOLibrary.DocIO.SkiaSharpSample()
Unhandled Exception: System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at SkiaSharp.SkiaApi.sk_version_get_milestone() at SkiaSharp.SkiaSharpVersion.get_Native() at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible) at SkiaSharp.SKObject..cctor() --- End of inner exception stack trace --- at SkiaSharp.SKObject.get_Handle() at SkiaSharp.SKNativeObject.Dispose(Boolean disposing) at SkiaSharp.SKBitmap.Dispose(Boolean disposing) at SkiaSharp.SKNativeObject.Finalize()`
Are you able to zip up the samples so I can look?
I have tried below approach, but not works.
You can find the things we tried and error faced details in attached Word document. Also, the PythonWrapper.zip contains the .NET application and python code.
Could you please try and suggest solution with runnable sample.
Description
We are creating python wrapper based Web API to call C# method via python. While using SkiaSharp related code, we facing errors even loaded the SkiaSharp dlls in python.
Target: .NET Standard 2.0 Python version : 3.9
Any workaround also helpful.
Code
Python:
C#:
Replication steps
Expected Behavior
Work properly
Actual Behavior
Exception
Version of SkiaSharp
SkiaSharp.HarfBuzz,"2.88.8"
Last Known Good Version of SkiaSharp
6.88.6 (Deprecated)
IDE / Editor
Visual Studio Code (Windows)
Platform / Operating System
Windows
Relevant Log Output
Code of Conduct