Svg.Skia
Svg.Skia copied to clipboard
'System.AccessViolationException' occurred in SkiaSharp.dll - Possible issue with SKSvg method "load"
Hello, I am very much a C# novice, currently trying to develop a WPF desktop application in VS2022. Without going into too much detail, the application needs to be capable of opening and displaying SVG files while maintaining the path data. I created the following method to open and display the desired image: ` private void draw(string path, SKCanvas canvas) {
var svg = new SKSvg();
svg.Load(path);
if(svg.Picture != null)
{
canvas.DrawPicture(svg.Picture);
}
else
{
System.Windows.MessageBox.Show("Picture load fail");
}
}
`
The program breaks at the draw line with the exception in the title. The following provides more information:
I attempted to use svg.FromSvg(path)
instead, to which I received the error: System.Xml.XmlException
Message=Data at the root level is invalid. Line 1, position 1.
Source=System.Private.Xml
From the little I know, this seems to indicate an issue with the Load and FromSvg methods not being able to parse the given SVG file. I am wondering if this is simply a limitation of SKSvg, an issue on my end, or an issue with the library?
Looks like your svg file has invalid xml, can you post the svg file contents here?
No sample svg