Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uno.WinUI.Svg 5.0.48 not working #14506

Closed
baskren opened this issue Nov 21, 2023 · 6 comments
Closed

Uno.WinUI.Svg 5.0.48 not working #14506

baskren opened this issue Nov 21, 2023 · 6 comments
Assignees
Labels
area/svg Categorizes an issue or PR as relevant to SVG rendering difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@baskren
Copy link
Contributor

baskren commented Nov 21, 2023

Current behavior

The following element does not render in Uno 5.0.48:

<Image Source="ms-appx:///SvgTest/Assets/icon_foreground.svg" Stretch="UniformToFill"  Width="300" Height="300" HorizontalAlignment="Center" />

Platforms Notes:

  • WinUI : Build and render: success

    image
  • WPF : Build success; Render: Fail

    image
  • Android: Build: success; Render: fail

    image
Console log excerpt
[DOTNET] �[41m�[30mfail�[39m�[22m�[49m: Uno.UI.Svg.SvgProvider[0]
[DOTNET]       Failed to load SVG image.
[DOTNET]       System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
[DOTNET]          at System.Xml.XmlTextReaderImpl.Throw(Exception e)
[DOTNET]          at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
[DOTNET]          at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res)
[DOTNET]          at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
[DOTNET]          at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
[DOTNET]          at System.Xml.XmlTextReaderImpl.ReadData()
[DOTNET]          at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
[DOTNET]          at System.Xml.XmlTextReaderImpl.SwitchEncodingToUTF8()
[DOTNET]          at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
[DOTNET]          at System.Xml.XmlTextReaderImpl.Read()
[DOTNET]          at System.Xml.XmlTextReader.Read()
[DOTNET]          at Svg.SvgTextReader.Read() in /_/externals/SVG/Source/SvgTextReader.cs:line 66
[DOTNET]          at Svg.SvgDocument.Create[SvgDocument](XmlReader reader, SvgElementFactory elementFactory, List`1 styles) in /_/externals/SVG/Source/SvgDocument.cs:line 404
[DOTNET]          at Svg.SvgDocument.Create[SvgDocument](XmlReader reader) in /_/externals/SVG/Source/SvgDocument.cs:line 352
[DOTNET]          at Svg.SvgDocument.Open[SvgDocument](Stream stream, Dictionary`2 entities) in /_/externals/SVG/Source/SvgDocument.cs:line 299
[DOTNET]          at Svg.Model.SvgExtensions.Open(Stream stream) in /_/src/Svg.Model/SvgExtensions.IO.cs:line 329
[DOTNET]          at Svg.Skia.SKSvg.Load(Stream stream) in /_/src/Svg.Skia/SKSvg.Model.cs:line 63
[DOTNET]          at Uno.UI.Svg.SvgProvider.<>c__DisplayClass22_0.<LoadSvgAsync>b__0()
[ProfileInstaller] Installing profile for com.companyname.SvgTest
  • iOS : Build: success; Render: fail

    image
Noteworthy console logs
hread started: <Thread Pool> #2
Thread started: .NET ThreadPool Gate #3
Thread started: <Thread Pool> #4
	en.lproj
	Settings.bundle
	Assets.xcassets
	SvgTest
	Uno.Fonts.Fluent
	UnoSplash.storyboardc
	Frameworks
	Assets
	SvgTest/Assets/icon_foreground.scale-150.png
	SvgTest/Assets/SharedAssets.md
	SvgTest/Assets/icon_foreground.scale-125.png
	SvgTest/Assets/icon_foreground@3x.png
	SvgTest/Assets/icon_foreground@2x.png
	SvgTest/Assets/icon_foreground.scale-400.png
	SvgTest/Assets/icon_foreground.png
2023-11-21 17:33:52.850376-0500 SvgTest.Mobile[80728:1956662] warn: Windows.UI.UIFontHelper[0] Failed to get system font based on Segoe UI
Thread started: .NET Timer #5
Thread started:  #6
  • WASM: Build fail
    image

Expected behavior

SVG elements build and render as in 4.x versions of Uno

How to reproduce it (as minimally and precisely as possible)

Demo project:
SvgTest.zip

Workaround

Previous work around for WASM no longer works : #10940

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

<Project ToolsVersion="15.0">
  <ItemGroup>
    <PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
    <PackageVersion Include="Microsoft.Windows.Compatibility" Version="7.0.5" />
    <PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
    <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
    <PackageVersion Include="SkiaSharp.Skottie" Version="2.88.6" />
    <PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.6" />
    <PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
    <PackageVersion Include="Uno.Extensions.Logging.OSLog" Version="1.7.0" />
    <PackageVersion Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.7.0" />
    <PackageVersion Include="Uno.Resizetizer" Version="1.2.1" />
    <PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.48" />
    <PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" />
    <PackageVersion Include="Uno.Wasm.Bootstrap" Version="8.0.4" />
    <PackageVersion Include="Uno.Wasm.Bootstrap.DevServer" Version="8.0.4" />
    <PackageVersion Include="Uno.Wasm.Bootstrap.Server" Version="8.0.4" />
    <PackageVersion Include="Uno.WinUI" Version="5.0.48" />
    <PackageVersion Include="Uno.WinUI.Lottie" Version="5.0.48" />
    <PackageVersion Include="Uno.WinUI.DevServer" Version="5.0.48" />
    <PackageVersion Include="Uno.WinUI.Skia.Gtk" Version="5.0.48" />
    <PackageVersion Include="Uno.WinUI.Skia.Linux.FrameBuffer" Version="5.0.48" />
    <PackageVersion Include="Uno.WinUI.Skia.Wpf" Version="5.0.48" />
    <PackageVersion Include="Uno.WinUI.WebAssembly" Version="5.0.48" />
    <PackageVersion Include="Xamarin.Google.Android.Material" Version="1.10.0.1" />

    <!-- references that had to be added to get build to work -->
    <PackageVersion Include="harfbuzzsharp.nativeassets.ios" Version="7.3.0" />
    <PackageVersion Include="Uno.WinUI.Svg" Version="5.0.48" />
    <PackageVersion Include="SkiaSharp" Version="2.88.6" />
    <PackageVersion Include="Svg.Skia" Version="1.0.0.4" />
    <PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.6" />

  </ItemGroup>
</Project>

Affected platforms

WebAssembly, Android, iOS, Skia (WPF)

IDE

No response

IDE version

Microsoft Visual Studio Community 2022 (ARM 64-bit) - Current Version 17.8.1; VSMac (ARM64) 17.6.7 (build 417)

Relevant plugins

No response

Anything else we need to know?

Just out of curiosity - Do you have a document or video on:

  • How to setup your development environment for debugging the uno platform framework
  • Best practices for submitting pull requests

For problems like this, if bootstrapping the debug environment isn't too much of a burden, it might be just as effective for me to track down the root cause and submit a pull request.

@baskren baskren added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Nov 21, 2023
@Youssef1313 Youssef1313 added the area/svg Categorizes an issue or PR as relevant to SVG rendering label Nov 22, 2023
@MartinZikmund
Copy link
Member

To whoever will be investigating this - for the platforms where it fails to render - could it be that Resizetizer is eating up those svg files and generating pngs instead?

@baskren
Copy link
Contributor Author

baskren commented Nov 22, 2023

To whoever will be investigating this - for the platforms where it fails to render - could it be that Resizetizer is eating up those svg files and generating pngs instead?

The iOS logs seem to indicate that. The Android logs seem to indicate something else is at play?

@jeromelaban
Copy link
Member

@pictos does it look familiar?

@pictos
Copy link
Contributor

pictos commented Nov 23, 2023

@jeromelaban I'll take a look into it today. But Resizetizer should just convert the file if it's a UnoImage, if that happens in any other scenario it could be a bug on Resizetizer's end

@jeromelaban
Copy link
Member

This is the same issue as #14465, and is caused by #13839.

@jeromelaban jeromelaban closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
@baskren
Copy link
Contributor Author

baskren commented Nov 25, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/svg Categorizes an issue or PR as relevant to SVG rendering difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

6 participants