beto-rodriguez / LiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.
https://livecharts.dev
MIT License
4.39k stars 573 forks source link

Description of the installation for Blazor WASM may not be sufficient. Got "System.DllNotFoundException: libSkiaSharp" #1689

Open CReizner opened 3 weeks ago

CReizner commented 3 weeks ago

Describe the bug I tried the example in the installation description for Blazor WASM and get this error:

System.DllNotFoundException: libSkiaSharp [blazor.webassembly.js:1:46958]
at SkiaSharp.SKTypeface..cctor() [blazor.webassembly.js:1:46958]
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: ReferenceError: GL is not defined
Microsoft.JSInterop.JSException: ReferenceError: GL is not defined
 ---> ReferenceError: GL is not defined
   --- End of inner exception stack trace ---
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeJS(String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId)
   at Microsoft.JSInterop.JSInProcessRuntime.Invoke[GLInfo](String identifier, Int64 targetInstanceId, Object[] args)
   at Microsoft.JSInterop.Implementation.JSInProcessObjectReference.Invoke[GLInfo](String identifier, Object[] args)
   at SkiaSharp.Views.Blazor.Internal.JSModuleInterop.Invoke[GLInfo](String identifier, Object[] args)
   at SkiaSharp.Views.Blazor.Internal.SKHtmlCanvasInterop.InitGL()
   at SkiaSharp.Views.Blazor.SKGLView.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

This was a Blazor standalone project with NET 8. A similar error occurred with a Blazor app with InteractiveWebAssembly.

Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HN7SRCQ37NGL", Request id "0HN7SRCQ37NGL:00000001": An unhandled exception was thrown by the application.
      System.NullReferenceException: Object reference not set to an instance of an object.
         at SkiaSharp.Views.Blazor.SKGLView.Dispose()
         at Microsoft.AspNetCore.Components.Rendering.ComponentState.DisposeAsync()
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.Dispose(Boolean disposing)
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.Dispose(Boolean disposing)
         at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<InvokeAsync>g__Execute|8_0(ValueTuple`3 state)
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.DisposeAsync()
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.<DisposeAsync>g__Await|26_0(Int32 i, ValueTask vt, List`1 toDispose)
         at Microsoft.AspNetCore.Http.Features.RequestServicesFeature.<DisposeAsync>g__Awaited|9_0(RequestServicesFeature servicesFeature, ValueTask vt)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.<FireOnCompleted>g__ProcessEvents|242_0(HttpProtocol protocol, Stack`1 events)

I also tried adding the NuGet package SkiaSharp.NativeAssets.Linux. Then the Bilbiotek libSkiaSharp appears in the project, but the same error occurs.

Desktop (please complete the following information):