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] Blazor App Crashes in AOT mode with SkiaSharp.HarfBuzz in .NET 8 #3049

Open
1 task done
elepner opened this issue Oct 31, 2024 · 4 comments · May be fixed by #3082
Open
1 task done

[BUG] Blazor App Crashes in AOT mode with SkiaSharp.HarfBuzz in .NET 8 #3049

elepner opened this issue Oct 31, 2024 · 4 comments · May be fixed by #3082
Labels
area/SkiaSharp.Views.Blazor Issues relating to the views for ASP.NET Blazor. os/WASM Issues running on WebAssembly (ASP.NET Blazor or Uno Platform) type/bug

Comments

@elepner
Copy link

elepner commented Oct 31, 2024

Description

The library SkiaSharp.HarfBuzz does not work at all in AOT mode with .NET 8 and 9, however everything works fine in .NET 7.
image

Code

The github repo with minimal project to reproduce:
https://github.com/elepner/harfbuzzsharp-wasm-aot-bug/tree/report_bug

Publish the project
dotnet publish -c Release -o wasm-output
navigate to the output folder wasm-output/wwwroot and start any http-server.

Expected Behavior

The app should not crash.

Actual Behavior

No response

Version of SkiaSharp

2.88.8 (Current)

Last Known Good Version of SkiaSharp

2.88.7 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Other (Please indicate in the description)

Platform / Operating System Version

Blazor

Devices

Google chrome

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

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

Does it work with SkiaSharp 3.0?

@elepner
Copy link
Author

elepner commented Nov 4, 2024

If I update SkiaSharp.HarfBuzz to the version 3.0.0-preview.5.4 along with SkiaSharp.NativeAssets.WebAssembly I get the error

Unhandled exception rendering component: The type initializer for 'SkiaSharp.SKObject' threw an exception.
System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
 ---> System.InvalidOperationException: The version of the native libSkiaSharp library (116.0) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [88.1, 89.0).

@mattleibow mattleibow added area/SkiaSharp.Views.Blazor Issues relating to the views for ASP.NET Blazor. area/SkiaSharp.HarfBuzz os/WASM Issues running on WebAssembly (ASP.NET Blazor or Uno Platform) and removed area/SkiaSharp.Views.Blazor Issues relating to the views for ASP.NET Blazor. labels Nov 11, 2024
@elepner
Copy link
Author

elepner commented Nov 15, 2024

I have given a try to run this in .net9 with no success. There's another error which appears even in Debug mode.

logging.ts:43 MONO_WASM: instantiate_wasm_module() failed CompileError: WebAssembly.compileStreaming(): Compiling function #28714:"CompressionNative_Crc32" failed: expected 1 elements on the stack for fallthru, found 3 @+8898931

The code: https://github.com/elepner/harfbuzzsharp-wasm-aot-bug/tree/net9_bug

@mattleibow mattleibow linked a pull request Nov 26, 2024 that will close this issue
5 tasks
@mattleibow
Copy link
Contributor

mattleibow commented Nov 26, 2024

This may be fixed with #3064

Can you try the nightly on the preview feed: 3.118.0-nightly.27

https://aka.ms/skiasharp-eap/index.json

Let me know if this fixes it and I will push out the 3.x release.

EDIT: I see my fix was in the Blazor package, so will not reach your project. I got a PR to fix it in all the WASM things.

A fix for you now with the nightly will be to just install the Blazor package. I hope to have that fix merged ASAP.

@mattleibow mattleibow added area/SkiaSharp Issues that relate to the C# binding of SkiaSharp. area/SkiaSharp.Views.Blazor Issues relating to the views for ASP.NET Blazor. and removed area/SkiaSharp.HarfBuzz area/SkiaSharp Issues that relate to the C# binding of SkiaSharp. labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/SkiaSharp.Views.Blazor Issues relating to the views for ASP.NET Blazor. os/WASM Issues running on WebAssembly (ASP.NET Blazor or Uno Platform) type/bug
Projects
Status: Ready For Work
Development

Successfully merging a pull request may close this issue.

2 participants