Skip to main content
All docs
V26.1
  • SvgImageLimits.MaxElementCount Property

    Specifies the maximum number of elements in an SVG image (counted with references).

    Namespace: DevExpress.Utils.Svg

    Assembly: DevExpress.Data.v26.1.dll

    NuGet Package: DevExpress.Data

    Declaration

    public static int MaxElementCount { get; set; }

    Property Value

    Type Description
    Int32

    The maximum number of elements (counted with references). The default value is DefaultMaxElementCount (65,536). 0 disables the limit.

    Remarks

    The limit counts an element (together with its child elements) again each time a <use> element, clip path, pattern fill, or pattern stroke refers to this element.

    If an image exceeds the limit, the application does not load the image and throws an SvgImageLimitsExceededException. The SvgImageLimitsExceededException.Kind property returns SvgImageLimitKind.ElementCount.

    The application also does not load an image that contains a reference cycle (for instance, a <use> element that refers to its own parent). In this instance, the Kind property returns SvgImageLimitKind.ReferenceCycle. If you set the MaxElementCount property to 0, you also disable the check for reference cycles.

    The limit applies to the entire process. Set the property once at application startup, before the application loads SVG images.

    Warning

    Raise or disable this limit only if all SVG images in your application come from trusted sources. An SVG image with many referenced elements from an untrusted source can cause a denial of service.

    using DevExpress.Utils.Svg;
    
    // Call at application startup.
    SvgImageLimits.MaxElementCount = 256 * 1024;
    

    For additional information, refer to the following help topic: SVG Image Limits.

    See Also