Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] DllNotFoundException when trying to invoke Skia in a Wasi Wasm Console app #3015

Open
1 task done
enghch opened this issue Sep 23, 2024 · 3 comments
Open
1 task done
Labels

Comments

@enghch
Copy link

enghch commented Sep 23, 2024

Description

When trying to run a Wasi Console app that depends on SkiaSharp. It builds the single-file wasm just fine. I added the nuget package for the NativeAssets.WebAssembly. But when attempting to run, it throws:

"System.TypeInitializationException: TypeInitialization_Type, SkiaSharp.SKImageInfo --- System.DllNotFoundException: libSkiaSharp at SkiaSharp.SKImageInfo..cctor()

The NativeAssets has build targets for Blazor, but seems to be missing them for Wasi Wasm apps.

I'm on .NET 9 preview 6. Is there some workaround or something I'm missing? I attached a small repro project. I included the wasm file in case that's useful. If you're not familiar with wasi or wasitime, see in the instructions in the readme.
WasiSkiaSharpRepro.zip

Code

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
    <RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
    <OutputType>Exe</OutputType>
    <PublishTrimmed>true</PublishTrimmed>
	<WasmSingleFileBundle>true</WasmSingleFileBundle>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="SkiaSharp" Version="3.0.0-preview.4.1" />
    <PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" Version="3.0.0-preview.4.1" />
  </ItemGroup>
</Project>

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

2.88.2 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Other (Please indicate in the description)

Platform / Operating System Version

Wasi Wasm

Code of Conduct

  • I agree to follow this project's Code of Conduct
@SashelI
Copy link

SashelI commented Sep 24, 2024

Hi @enghch , I have a similar issue in Unity (see #3016 ) Do you think it's linked ?

@enghch
Copy link
Author

enghch commented Sep 24, 2024

Hmm! Good question. I was assuming the issue for me was because the NativeAssets package didn't include targets for wasi wasm. But maybe it's a larger issue with SkiaSharp in general?

@mattleibow
Copy link
Contributor

The 3.x series should be including the native assets. Have you tried that yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready For Work
Development

No branches or pull requests

3 participants