Repository navigation
Upgrade to SkiaSharp 4 for Microcharts 3.0 - #384
Conversation
SkiaSharp 4 removes SKPaint.TextSize, so a paint can no longer carry text sizing. The SKFont-based MeasureLabels/MeasureLabel remain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The SkiaSharp version is now a single SkiaSharpVersion property in Directory.Build.props, consumed by every project and fed into the meta-package nuspec as $skiasharpversion$. CI builds keep the -preview marker in their version suffix so prerelease packages can't be mistaken for a stable release on the feed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SkiaSharp 4 obsoletes the SKPath mutation methods; SKPathBuilder is the replacement and mirrors them one for one, so path construction is unchanged. Detached paths and builders are now disposed, fixing two leaked line-chart paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates Microcharts for the 3.0 preview line by moving the solution to the SkiaSharp 4.x package family and adapting drawing code to SkiaSharp 4 API changes (notably SKPathBuilder), while centralizing versioning in shared build props and preserving prerelease version suffixing in CI publishing.
Changes:
- Centralize SkiaSharp package versions via
SkiaSharpVersioninSources/Directory.Build.propsand update all project references + metapackage nuspec to consume it. - Replace mutable
SKPathconstruction withSKPathBuilder+Detach()in charts/helpers that build paths. - Remove legacy
SKPaint-based label measurement overloads and adjust publish workflow to keep-preview.<run>suffixing.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/Microcharts/Microcharts.csproj | Switch SkiaSharp reference to $(SkiaSharpVersion) |
| Sources/Microcharts/Helpers/RadialHelpers.cs | Use SKPathBuilder for sector paths (plus small cleanups needed) |
| Sources/Microcharts/Charts/RadialGaugeChart.cs | Build gauge arc path via SKPathBuilder |
| Sources/Microcharts/Charts/RadarChart.cs | Build clip path via SKPathBuilder |
| Sources/Microcharts/Charts/LineChart.cs | Build line/area paths via SKPathBuilder and fix disposal; needs guard for all-null series area fill |
| Sources/Microcharts/Charts/Legacy/LegacyPointChart.cs | Remove SKPaint-based MeasureLabel(s) overloads |
| Sources/Microcharts/Charts/HalfRadialGaugeChart.cs | Build gauge arc paths via SKPathBuilder |
| Sources/Microcharts.Samples.Maui/Microcharts.Samples.Maui.csproj | Switch SkiaSharp.Views.Maui.Controls reference to $(SkiaSharpVersion) |
| Sources/Microcharts.Samples.iOS/Microcharts.Samples.iOS.csproj | Switch SkiaSharp.Views reference to $(SkiaSharpVersion) |
| Sources/Microcharts.Samples.Android/Microcharts.Samples.Android.csproj | Switch SkiaSharp.Views reference to $(SkiaSharpVersion) |
| Sources/Microcharts.Metapackage/Microcharts.Metapackage.nuspec | Replace hardcoded SkiaSharp deps with $skiasharpversion$ token |
| Sources/Microcharts.Metapackage/Microcharts.Metapackage.csproj | Feed skiasharpversion=$(SkiaSharpVersion) into nuspec properties |
| Sources/Microcharts.Maui/Microcharts.Maui.csproj | Switch SkiaSharp.Views.Maui.Controls reference to $(SkiaSharpVersion) |
| Sources/Microcharts.iOS/Microcharts.iOS.csproj | Switch SkiaSharp.Views reference to $(SkiaSharpVersion) |
| Sources/Microcharts.Droid/Microcharts.Droid.csproj | Switch SkiaSharp.Views reference to $(SkiaSharpVersion) |
| Sources/Directory.Build.props | Set 3.0.0-preview defaults + add SkiaSharpVersion property |
| .github/workflows/publish.yml | Preserve -preview.<run> prerelease suffixing during publish builds |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
DrawNullPoint pushes an SKPoint(float.MinValue, float.MinValue) placeholder so the point list stays index-aligned with the entries. When every entry in a serie is null the DrawLineArea loop never adds a point, leaving lastPoint on that sentinel, and the trailing LineTo/Close built a degenerate fill path spanning float.MinValue. Bail out before closing the path instead. Also drop two unused locals from CreateSectorPath and fix a duplicated word in the comment above the full-circle branch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
All three Copilot review comments are addressed in 297649c, and the individual threads have been replied to and resolved.
On the last one: Note that none of the three are
|
# Conflicts: # Sources/Microcharts/Helpers/RadialHelpers.cs
4.152.1 is the latest stable SkiaSharp and brings the Skia m151 and m152 engine updates plus the m152 GlyphData fix. Neither line lists breaking changes, and the Microsoft.Maui.Controls floor stays at 10.0.20. Headless renders of every sample chart are pixel-identical to 4.150.1. Also update CLAUDE.md, which still described the library as built on SkiaSharp 3.x. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CI installed the newest 10.0.x SDK and workloads, so it drifted with every .NET release. Workload sets from 10.0.401.1 on ship the iOS 27 workload, which needs Xcode 27, and the macos-26 runner tops out at Xcode 26.6. They also move $(MauiVersion) to 10.0.110, which would silently raise the Microsoft.Maui.Controls floor of the published Microcharts.Maui package. Pin SDK 10.0.401 and workload set 10.0.401 (iOS 26.5.10318, MAUI 10.0.20) in both workflows, and Xcode 26.6 in the PR build. This is the exact toolchain the last green PR build used. Install the four workloads in one command so they all come from the pinned set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4.153.1 is the latest stable SkiaSharp. It moves the engine to Skia m153 and turns off RAW and DNG image decoding, which Microcharts does not use. The only listed breaking change is Linux font fallback, which may now pick a different face for text drawn without an explicit typeface. The Microsoft.Maui.Controls floor stays at 10.0.20. Headless renders of every sample chart on macOS are pixel-identical to 4.152.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Opens the Microcharts 3.0 line: the whole solution now targets SkiaSharp 4.153.1, versioned as
3.0.0-preview.Because main was first migrated to the v4-compatible APIs that already exist in SkiaSharp 3 (0268ceb), the actual upgrade diff is small:
SKPaint-basedMeasureLabels/MeasureLabeloverloads inLegacyPointChart— SkiaSharp 4 removesSKPaint.TextSize, so a paint can no longer carry text sizing. TheSKFont-based overloads remain.SkiaSharpVersionproperty inSources/Directory.Build.props, consumed by all csproj files and fed into the meta-package nuspec as$skiasharpversion$. Future bumps are a one-line change.SKPathBuilder(LineChart,RadarChart, both gauge charts,RadialHelpers) — SkiaSharp 4 obsoletes theSKPathmutation methods;SKPathBuildermirrors them one for one, andSKPathBuilderdoes not exist in SkiaSharp 3, so this part is v3-only by necessity. Also fixes two line-chart paths that were never disposed.publish.ymlkeeps the-previewmarker in the CI version suffix (3.0.0-preview.<run>); previously the run-number suffix replaced it, which would have made prerelease packages look stable on the feed.macos-26), and would raise theMicrosoft.Maui.Controlsfloor of the publishedMicrocharts.Mauipackage.The full solution (library, platform wrappers, samples) builds with zero errors and zero warnings,
dotnet packproduces correctly-versioned3.0.0-previewpackages with resolved nuspec dependencies, and the MAUI sample was verified visually on the iOS simulator (line charts with gradients and splines, Y-axis labels, value labels, legends all render identically to v2).That simulator check was done on 4.150.1. The later bumps to 4.152.1 and 4.153.1 were each checked with a headless macOS render of all 66 sample charts at two sizes, and the output was pixel-identical to the previous version. On 4.153.1 the full solution again builds in Release with zero errors and zero warnings, the packed
Microcharts.Mauidepends onSkiaSharp.Views.Maui.Controls4.153.1, and CI passes on both runners. The only breaking change listed for 4.153 (Linux font fallback) is not covered by these checks.🤖 Generated with Claude Code