Svg.Skia icon indicating copy to clipboard operation
Svg.Skia copied to clipboard

'System.AccessViolationException' occurred in SkiaSharp.dll - Possible issue with SKSvg method "load"

Open RamenStudios opened this issue 2 years ago • 1 comments

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: image

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?

RamenStudios avatar May 29 '22 19:05 RamenStudios

Looks like your svg file has invalid xml, can you post the svg file contents here?

wieslawsoltes avatar Aug 16 '22 06:08 wieslawsoltes

No sample svg

wieslawsoltes avatar Nov 20 '22 10:11 wieslawsoltes