Skip to content

DomException: Style declaration ending bracket missing when trying to render svg #309

Description

@AesElh

when attempting to render an svg file i'm getting

This exception was originally thrown at this call stack:
    SharpVectors.Dom.Css.CssStyleDeclaration.ParseString(string)
    SharpVectors.Dom.Css.CssStyleRule.Parse(ref string, object, bool, System.Collections.Generic.IList<string>, SharpVectors.Dom.Css.CssStyleSheetType)
    SharpVectors.Dom.Css.CssRuleList.Parse(ref string, object, bool, System.Collections.Generic.IList<string>, SharpVectors.Dom.Css.CssStyleSheetType)
    SharpVectors.Dom.Css.CssRuleList.CssRuleList(ref string, object, System.Collections.Generic.IList<string>, bool, SharpVectors.Dom.Css.CssStyleSheetType)
    SharpVectors.Dom.Css.CssStyleSheet.CssRules.get()
    SharpVectors.Dom.Svg.SvgDocument.GetFontUrl(SharpVectors.Dom.Css.CssStyleSheet, System.Collections.Generic.IList<System.Tuple<string, SharpVectors.Dom.Svg.SvgFontFaceElement>>, System.Collections.Generic.IDictionary<string, string>)
    SharpVectors.Dom.Svg.SvgDocument.GetFontUrls()
    SharpVectors.Dom.Svg.SvgDocument.OnLoaded()
    SharpVectors.Dom.Css.CssXmlDocument.Load(System.Xml.XmlReader)
    SharpVectors.Dom.Svg.SvgDocument.Load(string)

this is just a sample app with xaml of:

<UserControl x:Class="WindowsFormsApp2WebP.UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:WindowsFormsApp2WebP"
                xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <svgc:SvgViewbox x:Name="MySvgViewbox" Source="background.svg"/>
    </Grid>
</UserControl>
i had to redact the original svg as it was proprietary , but the same error will show up on the original svg as well, because it's css related 

Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions