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

Getting "System.NotSupportedException: Path Operation c" when trying to load a SVG #49

Open
Firlefanz opened this issue May 19, 2016 · 5 comments

Comments

@Firlefanz
Copy link

Firlefanz commented May 19, 2016

Hello,

Thanks a lot for your library :-)

I was using Xam.Plugins.Forms.Svg before. But it often throws a get_DtdInfo error and is not stable and no issue answered. So I found your library here and tried to use it for my Project.

My Project is an existing xamarin shared Project. In order to have all resources in one place I added an additional pcl assembly. In this one I added my resources (svg).

Each time I try to use it in xaml I get an error here in your SVGImage.cs LoadSvgFromResource:
var r = new SvgReader(new StreamReader(svgStream));
raises the exception "System.NotSupportedException: Path Operation c".

All my svg Images are added to the additional assembly as embedded Content. It worked in the other SVG.
The Xaml Looks like this:
<abstractions:SvgImage BackgroundColor="#FF884444" BindingContext="{x:Reference Test}" SvgAssembly="{Binding SvgAssembly}" SvgPath="{Binding SvgImage}" HeightRequest = "50" WidthRequest = "50" Grid.Column="0"/>

Binding SVGAssembly holds the additional assembly with all resources.
SVGImage binds to a complete path to the additional assembly like "MyClient_Resources.Resources.Icons.ic_call_48px.svg".

Any idea what's wrong? I am using the free SVG Images from Google "Material-design-icons-1.0.0".

Thanks a lot!

@Firlefanz
Copy link
Author

I tried to remove the additional assembly Name from all resources names in the xaml (at the beginning).

"Resources.Icons.ic_call_48px.svg"

I then get the error message:
System.Exception: Error retrieving Resources.Icons.ic_call_48px.svg make sure Build Action is Embedded Resource

It is Embedded Resource, I think it just cannot be found now.

@Firlefanz
Copy link
Author

Or is it the SVG I am using? It is one of the free Google SVGs:

@Firlefanz
Copy link
Author

If I copy your Logo SVG into my SVG it works. Any Change to get it working with the Standard Google SVGs? Or what do I have to Change in the SVG?

Thanks a lot :-)

@runelkrone
Copy link

I am getting this also with Android svg images. It appears to be coming from NGraphics.

{System.NotSupportedException: Path Operation c
at NGraphics.SvgReader.ReadPath (NGraphics.Path p, System.String pathDescriptor) [0x00466] in :0
at NGraphics.SvgReader.AddElement (IList1 list, System.Xml.Linq.XElement e, NGraphics.Pen inheritPen, NGraphics.Brush inheritBrush) [0x00553] in <filename unknown>:0 at NGraphics.SvgReader.AddElements (IList1 list, IEnumerable`1 es, NGraphics.Pen inheritPen, NGraphics.Brush inheritBrush) [0x00013] in :0
at NGraphics.SvgReader.Read (System.Xml.Linq.XDocument doc) [0x0018f] in :0
at NGraphics.SvgReader..ctor (System.IO.TextReader reader, Double pixelsPerInch) [0x0007a] in :0
at ... }

@johnnysbug
Copy link

johnnysbug commented Sep 8, 2016

This is likely because the underlying NGraphics version does not support SVGO, which is unfortunate. As a workaround, if you're on a mac and have Sketch, you can open existing svg files and export them as svg, and these will work with the current version of NGraphics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants