FFImageLoading icon indicating copy to clipboard operation
FFImageLoading copied to clipboard

All SVG are not displayed

Open pcdus opened this issue 5 years ago • 3 comments

🐛 Bug Report

I've a Xamarin.Forms app where I display some logos through SVG files. On the same page, I've one SVG that is well displayed, and the second one that is not displayed.

I've checked that the SVG is well formated/valid with these 2 websites: https://jakearchibald.github.io/svgomg/ https://validator.w3.org/#validate_by_uri

But the problem is still present.

Expected behavior

All the SVG images should be displayed

Actual behavior

All the SVG images are not be displayed

Reproduction steps

Add the SVG in the Resources, and specify the ActionBuild as EmbededResource Display the SVG like this:

<ffimageloadingsvg:SvgCachedImage Source="resource://ShellAppSample.Resources.MyLogo.svg"
     HeightRequest="150"/>

Configuration

Xamarin.Forms: 4.8.0.1451 Xamarin.FFImageLoading.Svg.Forms: 2.4.11.982 NotDisplayedLogo.svg.zip

Platform:

  • [ ] :iphone: iOS
  • [ ] :robot: Android
  • [ ] :checkered_flag: WPF
  • [ ] :earth_americas: UWP
  • [ ] :apple: MacOS
  • [ ] :tv: tvOS
  • [X] :monkey: Xamarin.Forms

pcdus avatar Oct 28 '20 14:10 pcdus

I can see the following details in the Application Output:

System.NullReferenceException: Object reference not set to an instance of an object
  at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, System.Collections.Generic.Dictionary`2[TKey,TValue] style) [0x0022e] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:558 
  at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill, System.Boolean isMask, System.Threading.CancellationToken token) [0x006d7] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:343 
  at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill, System.Boolean isMask, System.Threading.CancellationToken token) [0x007f4] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:396 
  at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill, System.Boolean isMask, System.Threading.CancellationToken token) [0x007f4] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:396 
  at FFImageLoading.Svg.Platform.SKSvg.LoadElements (System.Collections.Generic.IEnumerable`1[T] elements, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill, System.Threading.CancellationToken token) [0x00010] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:221 
  at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.Linq.XDocument xdoc, System.Threading.CancellationToken token) [0x00417] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:209 
  at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.XmlReader reader, System.Threading.CancellationToken token) [0x00000] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:100 
  at FFImageLoading.Svg.Platform.SKSvg.Load (System.IO.Stream stream, System.Threading.CancellationToken token) [0x00012] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:94 
  at FFImageLoading.Svg.Platform.SvgDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x0019d] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SvgDataResolver.cs:232 
  at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x0004e] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\WrappedDataResolver.cs:21 
  at FFImageLoading.Work.ImageLoaderTask`3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x00300] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:618

pcdus avatar Oct 28 '20 14:10 pcdus

you should search before creating a new issue. there are already dozens of issue for this one and one of the older version is working. please make your search.

EmilAlipiev avatar Dec 03 '20 15:12 EmilAlipiev

I always process my svg before use in projects with FFImageLoading. Just use this https://jakearchibald.github.io/svgomg/, its recommended by the author. In options, disable all "Round/Rewrite" options and "Style to attbributes".

valentasm1 avatar Jul 31 '21 12:07 valentasm1