Skip to content

Upgrade SkiaSharp to 3.119.2#1719

Merged
tonyqus merged 2 commits into
masterfrom
copilot/upgrade-skia-sharp-to-3-119-2
Mar 7, 2026
Merged

Upgrade SkiaSharp to 3.119.2#1719
tonyqus merged 2 commits into
masterfrom
copilot/upgrade-skia-sharp-to-3-119-2

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 7, 2026

Bumps SkiaSharp (and SkiaSharp.NativeAssets.Linux.NoDependencies) from 2.88.9 to 3.119.2. All existing TFMs (net472, netstandard2.0, netstandard2.1, net8.0) remain supported — 3.119.2 ships assets for all of them.

Package version change

Directory.Packages.props

-    <PackageVersion Include="SkiaSharp" Version="2.88.9" />
-    <PackageVersion Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.9" />
+    <PackageVersion Include="SkiaSharp" Version="3.119.2" />
+    <PackageVersion Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.2" />

API migration

SkiaSharp 3.x marks text-measurement APIs on SKPaint as [Obsolete] in favour of SKFont. The affected code was already constructing SKFont objects and then wrapping them in a throwaway SKPaint purely to call MeasureText/GetFontMetrics. Four call sites in SheetUtil.cs and EscherGraphics.cs are updated to call those methods directly on the SKFont:

// Before
using var paint = new SKPaint { Typeface = windowsFont.Typeface, TextSize = windowsFont.Size };
float textWidth = paint.MeasureText(str);
paint.GetFontMetrics(out SKFontMetrics metrics);

// After
float textWidth = windowsFont.MeasureText(str);
windowsFont.GetFontMetrics(out SKFontMetrics metrics);

This eliminates the obsolete-API warnings and removes the unnecessary allocations.

Original prompt

Create a pull request in nissl-lab/npoi (base branch master) that upgrades SkiaSharp to the latest stable version requested by maintainers.

Goal

Upgrade the centrally-managed package versions from SkiaSharp 2.x to SkiaSharp 3.119.2 while keeping the repository’s existing target frameworks (notably net472, netstandard2.0, netstandard2.1, net8.0).

Required changes

  1. Update Directory.Packages.props to set:
    • SkiaSharp -> 3.119.2
    • SkiaSharp.NativeAssets.Linux.NoDependencies -> 3.119.2
  2. Ensure all projects still restore/build.
    • Pay special attention to main/NPOI.Core.csproj which targets net472;netstandard2.0;netstandard2.1;net8.0 and references SkiaSharp packages.
  3. If the upgrade causes compile errors due to API changes, update code accordingly (minimal changes).
  4. If the upgrade breaks older TFMs due to SkiaSharp 3.x target framework support, implement a safe approach that preserves existing TFMs, e.g. conditional PackageReference or multi-targeted versioning (while still using 3.119.2 where possible) and document rationale in the PR description.
  5. Run/ensure CI checks pass (or update CI/build scripts if required for SkiaSharp 3.x).

Acceptance criteria

  • Repository builds successfully on master after the changes.
  • Unit tests (where present) pass.
  • No reduction in supported target frameworks unless explicitly unavoidable; if unavoidable, explain and scope the change.
  • PR includes a clear summary of why changes were needed and any compatibility constraints.

Files likely involved

  • Directory.Packages.props
  • Possibly code files using SkiaSharp (if compilation fails)
  • Potentially build/test workflow files if needed

Notes

  • Keep changes focused on the SkiaSharp upgrade; avoid unrelated refactors.

This pull request was created from Copilot chat.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

… to SKFont

Co-authored-by: tonyqus <772561+tonyqus@users.noreply.github.com>
Copilot AI changed the title [WIP] Upgrade SkiaSharp to latest stable version 3.119.2 Upgrade SkiaSharp to 3.119.2 Mar 7, 2026
@tonyqus tonyqus marked this pull request as ready for review March 7, 2026 06:42
@tonyqus tonyqus added this to the NPOI 2.8.0 milestone Mar 7, 2026
@tonyqus tonyqus merged commit 87cfe4f into master Mar 7, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants