There seems to be some kind of conflict with SkiaSharp library that Xamarin Forms and FFImageLoading uses. This wasn't an issue before.
<?xml version="1.0" encoding="UTF-8"?>
<svg width="201px" height="2px" viewBox="0 0 201 2" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 54 (76480) - https://sketchapp.com -->
<title>entry field</title>
<desc>Created with Sketch.</desc>
<g id="Intro/Onboarding" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square">
<g id="1.1-Zip-Code-Entry" transform="translate(-87.000000, -358.000000)" fill-rule="nonzero" stroke="#231E51">
<g id="Entry-Field" transform="translate(88.000000, 325.000000)">
<g id="entry-field" transform="translate(0.127341, 33.000000)">
<path d="M2.27373675e-13,1 L33.8726592,1" id="Line"></path>
<path d="M41.25,1 L75.1226592,1" id="Line"></path>
<path d="M82.5,1 L116.372659,1" id="Line"></path>
<path d="M123.75,1 L157.622659,1" id="Line"></path>
<path d="M165,1 L198.872659,1" id="Line"></path>
</g>
</g>
</g>
</g>
</svg>
<ffs:SvgCachedImage Source="resource://App28.bg_field_bottom_border.svg" Aspect="AspectFill" HeightRequest="100" WidthRequest="100" />
FFImageLoading Svg Images renders on the page.
None of the FFImageLoading Svg Images render at all.
From the Build Log
3>Found conflicts between different versions of "SkiaSharp" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
From the Debug Log
Image loading failed: resource://App28.Resources.bg_field_bottom_border.svg?assembly=App28,%20Version=1.0.0.0,%20Culture=neutral,%20PublicKeyToken=null;(size=0x0,dip=True,type=SvgDataResolver)
System.MissingMethodException: Method not found: void SkiaSharp.SKPath.AddRoundRect(SkiaSharp.SKRect,single,single,SkiaSharp.SKPathDirection)
at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x00440] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:280
at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:356
at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimagelo
ading\source\FFImageLoading.Svg.Shared\SkSvg.cs:356
04-11 19:11:35.706 I/mono-stdout(29706): Image loading failed: resource://App28.Resources.bg_field_bottom_border.svg?assembly=App28,%20Version=1.0.0.0,%20Culture=neutral,%20PublicKeyToken=null;(size=0x0,dip=True,type=SvgDataResolver)
04-11 19:11:35.706 I/mono-stdout(29706): System.MissingMethodException: Method not found: void SkiaSharp.SKPath.AddRoundRect(SkiaSharp.SKRect,single,single,SkiaSharp.SKPathDirection) at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:356
at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:356
at FFImageLoading.Svg.Platform.SKSvg.LoadElements (System.Collections.Generic.IEnumerable`1[T] elements, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x00010] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:214
at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.Linq.XDocument xdoc) [0x003f9] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:202
at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.XmlReader reader) [0x00000] in C:\projects\ff
04-11 19:11:35.706 I/mono-stdout(29706): at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x00440] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:280 imageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:96
at FFImageLoading.Svg.Platform.SKSvg.Load (System.IO.Stream stream) [0x00012] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:90
at FFImageLoading.Svg.Platform.SvgDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00198] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SvgDataResolver.cs:102
at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00044] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\WrappedDataResolver.cs:22
at FFImageLoading.Work.ImageLoaderTask`3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x00300] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:553
04-11 19:11:35.707 I/mono-stdout(29706): at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:356
04-11 19:11:35.707 I/chatty (29706): uid=10090(com.companyname.App28) Thread Pool Wor identical 2 lines
04-11 19:11:35.708 I/mono-stdout(29706): at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:356
04-11 19:11:35.708 I/mono-stdout(29706): at FFImageLoading.Svg.Platform.SKSvg.LoadElements (System.Collections.Generic.IEnumerable`1[T] elements, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x00010] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:214
04-11 19:11:35.708 I/mono-stdout(29706): at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.Linq.XDocument xdoc) [0x003f9] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:202
04-11 19:11:35.711 I/mono-stdout(29706): at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.XmlReader reader) [0x00000] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:96
04-11 19:11:35.711 I/mono-stdout(29706): at FFImageLoading.Svg.Platform.SKSvg.Load (System.IO.Stream stream) [0x00012] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:90
04-11 19:11:35.712 I/mono-stdout(29706): at FFImageLoading.Svg.Platform.SvgDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00198] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SvgDataResolver.cs:102
04-11 19:11:35.713 I/mono-stdout(29706): at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00044] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\WrappedDataResolver.cs:22
04-11 19:11:35.714 I/mono-stdout(29706): at FFImageLoading.Work.ImageLoaderTask`3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x00300] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:553
Workaround
I believe I have found a workaround. It seems to work better when I install the SkiaSharp library.
Nuget Packages:
Xamarin.Forms 3.6.0.293080
FormsToolkit 2.0.1
Humanizer 2.6.2
Newtonsoft.Json 12.0.1
NodaTime 2.4.5
Plugin.Permissions 3.0.0.12
Refractored.MvvmHelpers 1.3.0
Refractored.XamForms.PullToRefresh 2.4.1
Xamarin.FFImageLoading 2.4.5.880-pre
Xamarin.FFImageLoading.Forms 2.4.5.880-pre
Xamarin.FFImageLoading.Svg 2.4.5.880-pre
Xamarin.FFImageLoading.Svg.Forms 2.4.5.880-pre
Xamarin.FFImageLoading.Transformations 2.4.5.880-pre
Xamarin.Essentials 1.1.0
Xamarin.HotReload 1.2.4
Affected Devices: All
/cc @mattleibow
@seansparkman Can you please attach a small project that demonstrates this issue? Thanks!
Here is the project with the issue. I created a branch with the workaround.
https://github.com/seansparkman/Xamarin.Forms.Svg
I've run into the same issue using Forms v4.0.0.304370-pre8 but I think the issue may be at the FFImageLoading end. I have two demo apps both using Forms v4.0.0.304370-pre8...
One app uses FFImageLoading.Forms + FFImageLoading.Svg.Forms v2.4.5.870-pre - it displays images and does not have SkiaSharp errors in the debug log.
The other app uses FFImageLoading.Forms + FFImageLoading.Svg.Forms v2.4.5.900-pre - it does not display images and I get the same SkiaSharp errors in my debug log as Sean until I use his workaround.
@seansparkman Thanks for the workaround, it helped me figure out what was going wrong with my app. Maybe you could try the earlier 870-pre release of FFImageLoading and see if it works for you?
Verified that it's still an issue with the latest FFImageLoading prerelease, too. Still not sure if this is should be investigated in Forms, Skia, or FFImageLoading. //cc @daniel-luberda @mattleibow
Somehow Visual Studio is not adding SkiaSharp package (which is listed as a dependency). Manually adding SkiaSharp package solves it. I suppose it should be moved to VS Issue Tracker.