mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.52k stars 540 forks source link

The type initializer for 'SkiaSharp.SKImageInfo' threw an exception #2732

Open kbrow20 opened 9 months ago

kbrow20 commented 9 months ago

Description

I am running running a webassembly blazor application and I included the nuget package for SkiaSharp and NativeAssets.WebAssembly. When I try and generate the QR barcode in my test environment on Windows it gives me this error message.

This is the first time trying to use SkiaSharp in a coding enivornment.

Code

using SkiaSharp; using SkiaSharp.QrCode;

using MemoryStream ms = new(); QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeData qrCodeData = qrGenerator.CreateQrCode(Input, ECCLevel.L); var info = new SKImageInfo(512, 512); using var surface = SKSurface.Create(info);

Expected Behavior

No response

Actual Behavior

I get The type initializer for 'SkiaSharp.SKImageInfo' threw an exception with an inner exception of dllnotfound libSkiaSharp

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Windows 11

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

keyhanbati commented 4 months ago

hello everyone. on linux debian 11 i copy file 'libSkiaSharp.so' from path './runtimes/linux-x64/native/' beside root of project publish folder. beside to the executable file of the project such as webapi.exe