Repository navigation
Description
Current behavior 🐛
The Svg UnoFeature adds an implicit Svg.Skia package reference pinned to 3.0.6 (SvgSkia group in src/Uno.Sdk/packages.json, still 3.0.6 on current master). Svg.Skia is now at 5.2.3 on nuget.org.
If the app (transitively, through a library) references a newer Svg.Skia, restore fails:
error NU1605: Warning As Error: Detected package downgrade: Svg.Skia from 4.3.0 to 3.0.6.
App -> Lib -> Svg.Skia (>= 4.3.0)
App -> Svg.Skia (>= 3.0.6)
Any app/library that uses Svg.Skia directly (for example to rasterize SVG into SkiaSharp itself) cannot enable Svg without an explicit override.
On master the pin is also well behind the rest of the Skia stack: SkiaSharp is 4.151.1 (src/Directory.Packages.props), while Svg.Skia 3.0.6 depends on SkiaSharp >= 2.88.9. I did not test whether that combination misbehaves at runtime; the SamplesApp builds with it.
Expected behavior 🎯
The implicit Svg.Skia version should track a current release so common apps don't hit NU1605 (and ideally align with the SkiaSharp major used by Uno). Svg.Skia 4.x/5.x also changed its asset-loader API (see the closed #21372 and #21378), so a bump needs the Uno.UI.Svg add-in re-validated against the new version.
How to reproduce it (as minimally and precisely as possible) 🔬
- Create
lib/Lib.csproj:<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup><TargetFramework>net10.0</TargetFramework></PropertyGroup> <ItemGroup><PackageReference Include="Svg.Skia" Version="4.3.0" /></ItemGroup> </Project>
- Create
global.jsonwith{ "msbuild-sdks": { "Uno.Sdk": "6.7.22" } }andApp.csproj:<Project Sdk="Uno.Sdk"> <PropertyGroup> <TargetFrameworks>net10.0-desktop</TargetFrameworks> <OutputType>Exe</OutputType> <UnoFeatures>Svg</UnoFeatures> </PropertyGroup> <ItemGroup> <ProjectReference Include="lib\Lib.csproj" /> </ItemGroup> </Project>
- Run
dotnet restore App.csproj. NU1605 as above (runtime-backed, Uno.Sdk 6.7.22).
Note: referencing Svg.Skia directly from the app head (instead of transitively) restores fine, because the explicit reference wins over the implicit one.
Workaround
Set the existing SDK property, e.g. <SvgSkiaVersion>4.3.0</SvgSkiaVersion> in the head's csproj (verified: restore succeeds with the repro above), or reference Svg.Skia directly from the head. SVG rendering with a newer Svg.Skia was only checked on the Skia desktop head by the original reporter.
Works on UWP/WinUI
N/A (Uno SDK packaging).
Environment
Uno.Sdk 6.7.22 (restore repro); the 3.0.6 pin is unchanged on master bfc8dffd7fe.
NuGet package version(s) affected
Uno.Sdk 6.4.42 (first seen), 6.7.22 (reproduced), master.
Affected platforms
Skia heads (desktop reproduced; the pin applies to every head using the Svg feature)
IDE
CLI (dotnet restore)
Relevant plugins
No response
Anything else we need to know? 💬
Where the pin lives on master:
Lines 105 to 111 in bfc8dff
{ "group": "SvgSkia", "version": "3.0.6", "packages": [ "Svg.Skia" ] }, <_UnoProjectSystemPackageReference Include="Svg.Skia" ProjectSystem="true" Condition="$(UnoFeatures.Contains(';svg;')) AND $(IsUnoHead) == 'true'" /> uno/src/Directory.Packages.props
Line 143 in bfc8dff
<PackageVersion Include="Svg.Skia" Version="3.0.6" />
Related, same family but not a duplicate: #24259 (SkiaSharp 3.x pins vs apps on SkiaSharp 4.x).
Activity
chore(deps): Bump Svg.Skia to 5.2.3
chore(deps): Bump Svg.Skia to 5.2.3