-
Notifications
You must be signed in to change notification settings - Fork 597
Open
Labels
area/SkiaSharp.Views.BlazorIssues relating to the views for ASP.NET Blazor.Issues relating to the views for ASP.NET Blazor.os/WASMIssues running on WebAssembly (ASP.NET Blazor or Uno Platform)Issues running on WebAssembly (ASP.NET Blazor or Uno Platform)os/Windows-Universal-UWPtenet/reliabilityIssues relating to crashes or unexpected behaviorsIssues relating to crashes or unexpected behaviorstype/bug
Description
Description
Per Microsoft Learn example: https://learn.microsoft.com/en-us/aspnet/core/blazor/webassembly-native-dependencies?view=aspnetcore-10.0&utm_source=chatgpt.com
Navigate to a page with the component on it and receive error.
SkiaSharp version 3.119.2-preview.1 (also tried 3.118.0-preview.2.3 and 3.119.1)
Code
Project file:
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.0" PrivateAssets="all" />
<PackageReference Include="SkiaSharp.Views.Blazor" Version="3.119.2-preview.1" />
</ItemGroup>
</Project>(same issue with release build)
Razor component:
@using SkiaSharp
@using SkiaSharp.Views.Blazor
<SKCanvasView OnPaintSurface="OnPaintSurface" IgnorePixelScaling="true" />
@code {
private void OnPaintSurface(SKPaintSurfaceEventArgs args)
{
var canvas = args.Surface.Canvas;
canvas.Clear(SkiaSharp.SKColors.White);
using var paint = new SkiaSharp.SKPaint
{
Color = SkiaSharp.SKColors.Black,
IsAntialias = true,
Style = SkiaSharp.SKPaintStyle.Fill
};
using var font = new SkiaSharp.SKFont { Size = 24 };
var coord = new SkiaSharp.SKPoint(args.Info.Width / 2, (args.Info.Height + font.Size) / 2);
canvas.DrawText("SkiaSharp", coord, font, paint);
}
}Expected Behavior
Display the barcode in a canvas.
Actual Behavior
ManagedError: TypeInitialization_Type, SkiaSharp.SKImageInfo
Version of SkiaSharp
3.118.0-preview.2 (Next Preview)
Last Known Good Version of SkiaSharp
2.88.9 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Windows 11 Pro
VS 2026
.net 10
Edge/Chrome
Devices
All
Relevant Screenshots
No response
Relevant Log Output
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
area/SkiaSharp.Views.BlazorIssues relating to the views for ASP.NET Blazor.Issues relating to the views for ASP.NET Blazor.os/WASMIssues running on WebAssembly (ASP.NET Blazor or Uno Platform)Issues running on WebAssembly (ASP.NET Blazor or Uno Platform)os/Windows-Universal-UWPtenet/reliabilityIssues relating to crashes or unexpected behaviorsIssues relating to crashes or unexpected behaviorstype/bug
Type
Projects
Status
New