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.38k stars 573 forks source link

LiveCharts 2 in Blazor WASM with .NET 9 preview - error #1451

Open twestosaurus opened 9 months ago

twestosaurus commented 9 months ago

Hi,

I had a .NET 8 Blazor WASM app that I just upgraded to the preview of .NET 9. However after the upgrade I just get an error when a LiveChart should be loaded:

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: ReferenceError: Module is not defined
Microsoft.JSInterop.JSException: ReferenceError: Module is not defined
 ---> ReferenceError: Module 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)

Does anyone have an idea what I could do about this? Is the LiveCharts just not compatible with .NET 9?

beto-rodriguez commented 2 months ago

I have not yet tried LiveCharts with net 9, currently net 9 is in preview but I am sure that it will work in a future version of net 9.