-
Notifications
You must be signed in to change notification settings - Fork 810
Closed
Copy link
Labels
difficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.Categorizes an issue for which the difficulty level needs to be defined.triage/untriagedIndicates an issue requires triaging or verificationIndicates an issue requires triaging or verification
Description
Current behavior 🐛
After updating to Uno.Sdk 6.2.29 (or latest 6.3.0-dev vesions), SVG images no longer display, and the app logs a TypeLoadException
from Uno.UI.Svg
. The same sample project provided as an example works properly with Uno.Sdk 6.1.23.
fail: Uno.UI.Svg.SvgProvider[0]
Failed to load SVG image.
System.TypeLoadException: Method 'GetFontMetrics' in type 'Uno.Svg.Skia.SkiaAssetLoader' from assembly 'Uno.UI.Svg, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null' does not have an implementation.
at Uno.Svg.Skia.SKSvg..ctor()
at Uno.UI.Svg.SvgProvider.<>c__DisplayClass23_0.<LoadSvgAsync>b__0() in C:\a\1\s\src\AddIns\Uno.UI.Svg\SvgProvider.cs:line 165
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Uno.UI.Svg.SvgProvider.TryLoadSvgDataAsync(Byte[] svgBytes) in C:\a\1\s\src\AddIns\Uno.UI.Svg\SvgProvider.cs:line 119
Expected behavior 🎯
SVG renders properly even after 6.2.x or above version update.
How to reproduce it (as minimally and precisely as possible) 🔬
- Create a new Uno Blank app, for example, with Uno.Sdk 6.2.29 (or latest 6.3.0-dev vesions)
- Enable the
Svg;
UnoFeature in the ProjectName.csproj (following the SVG documentation) - Add an SVG file under
Assets/Svg/
(e.g.,Assets/Svg/logo.svg
). - Add
<Image Source="ms-appx:///Assets/Svg/logo.svg" />
in theStackPanel
inMainPage.xaml
OR
- Use the sample repro app: UnoSvgIssueRepro.zip
Then:
- Launch the app for any platform (e.g., Desktop)
- Notice the System.TypeLoadException, and the SVG is not displayed using Uno.Sdk 6.2.29
(Compare using Uno.Sdk 6.1.23 and notice no exception, and the SVG logo is properly displayed.)
Workaround 🛠️
Override the Svg.Skia
version to 3.0.3 by adding <SvgSkiaVersion>3.0.3</SvgSkiaVersion>
to your ProjectName.csproj
.
Renderer 🎨
- Skia
- Native
Affected platforms 📱💻🖥️
All platforms 🌍
Uno.Sdk version (and other relevant versions) 📦
6.2.29, 6.3.0-dev latest versions
IDE version 🧑💻
VS 2022 - 17.14.13
Sub-issues
Metadata
Metadata
Assignees
Labels
difficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.Categorizes an issue for which the difficulty level needs to be defined.triage/untriagedIndicates an issue requires triaging or verificationIndicates an issue requires triaging or verification