Skip to content

[BUG] .NET 9 Blazor exception: Could not load type of field 'SkiaSharp.Views.Blazor.Internal.JSModuleInterop:moduleTask' ... #2991

@Apollo3zehn

Description

@Apollo3zehn

Description

The Blazor sample application is not working with .NET 9 Preview 7. It gives me the following error:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Could not set up parent class, due to: Could not load type of field 'SkiaSharp.Views.Blazor.Internal.JSModuleInterop:moduleTask' (0) due to: Could not resolve type with token 0100003b from typeref (expected class 'Microsoft.JSInterop.IJSUnmarshalledObjectReference' in assembly 'Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60') assembly:Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 type:Microsoft.JSInterop.IJSUnmarshalledObjectReference member:(null) assembly:SkiaSharp.Views.Blazor.dll type:JSModuleInterop member:(null)
System.TypeLoadException: Could not set up parent class, due to: Could not load type of field 'SkiaSharp.Views.Blazor.Internal.JSModuleInterop:moduleTask' (0) due to: Could not resolve type with token 0100003b from typeref (expected class 'Microsoft.JSInterop.IJSUnmarshalledObjectReference' in assembly 'Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60') assembly:Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 type:Microsoft.JSInterop.IJSUnmarshalledObjectReference member:(null) assembly:SkiaSharp.Views.Blazor.dll type:JSModuleInterop member:(null)
   at SkiaSharp.Views.Blazor.SKCanvasView.OnAfterRenderAsync(Boolean firstRender)

This does not happen when targeting .NET 8 (and downgrading the ASP.NET Core Nuget dependencies Microsoft.AspNetCore.Components.WebAssembly and Microsoft.AspNetCore.Components.WebAssembly.DevServer to .NET 8).

Skia Sharp Version 3.0.0-preview.4.1

Code

  1. Install .NET 9 preview 7 SDK
  2. Clone https://github.com/Apollo3zehn/SkiaSharpBlazorIssue
  3. Run the application
  4. Go to http://localhost:5000/raster
  5. Open the Browser developer tools and find the error

Expected Behavior

I expect the Blazor sample (https://github.com/mono/SkiaSharp/tree/main/samples/Basic/BlazorWebAssembly) to work as it does with .NET 8.

Actual behavior

grafik

Actual Behavior

The error shown in the description above and in the screenshot below appears.

Version of SkiaSharp

Other (Please indicate in the description)

Last Known Good Version of SkiaSharp

2.88.2 (Previous)

IDE / Editor

Visual Studio Code (Linux)

Platform / Operating System

Linux

Platform / Operating System Version

.NET 9 Preview 7
Kubuntu 24.04
x64
Firefox Browser 130.0
Edge Browser 128.0.2739.63

Devices

No response

Relevant Screenshots

grafik

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions