unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.06k stars 735 forks source link

SVG not rendering/crashing #10766

Closed Marc-Antoine-Soucy closed 1 year ago

Marc-Antoine-Soucy commented 1 year ago

Current behavior

When following the instruction on this page, it doesnt work, and I cannot seem to figure out how to make svg images show up. On the only app where it worked (the images showed up on WinUI), the image still didnt show up on IOS and crashed the app on android.

https://github.com/unoplatform/uno/discussions/10750

Expected behavior

The image should show up on all platform when you follow the documentation, and set the source of the image as an svg.

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

SvgImg.zip

Workaround

None that I found

Works on UWP/WinUI

No

Environment

No response

NuGet package version(s)

    <PackageReference Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.3" />
    <PackageReference Include="Uno.WinUI" Version="4.7.0-dev.666" />
    <PackageReference Include="Uno.WinUI.RemoteControl" Version="4.7.0-dev.666" Condition="'$(Configuration)'=='Debug'" />
    <PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="4.6.18" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
    <PackageReference Include="Uno.WinUI.Lottie" Version="4.6.18" />
    <PackageReference Include="Uno.WinUI.Svg" Version="4.7.0-dev.666" />

Affected platforms

Android, iOS, Windows

IDE

Visual Studio 2022

IDE version

17.4.1

Relevant plugins

No response

Anything else we need to know?

No response

MartinZikmund commented 1 year ago

@Marc-Antoine-Soucy I think one issue is that the svg file needs to be marked with the Build Action of Content in the shared project. I will investigate the errors further though.

Marc-Antoine-Soucy commented 1 year ago

@MartinZikmund You're right that it was indeed why it wasn't showing up on WinUI. However, even when the build action is set to content, it work for Android (in the sample, not in the app that throws exception), but it still doesnt work with IOS. App13.zip This is a xamarin app (for some reason, I can't deploy the other project on my mac, I will check it out later, but the xamarin app still shows the problem)

MartinZikmund commented 1 year ago

Link to original discussion #10750

MartinZikmund commented 1 year ago

The problem was only occurring in Xamarin.iOS specifically because of System.Memory version mismatch. The PR will adjust this by including a workaround for this problem. This workaround can be disabled by declaring the following in the iOS .csproj, if needed:

<UnoDisableSystemMemoryMismatchWorkaround>true</UnoDisableSystemMemoryMismatchWorkaround>