Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[BUG] SKManagedWStream with SKSvgCanvas missing close SVG tag </svg> #3520

Open
Labels
@IainS1986

Description

@IainS1986

Description

This seems to be a 'recent' issue as it certainly used to work, but it could well have been broken for a while (maybe since 3.X release?)

We are generating SVG data from some canvas commands and it seems to consistently miss the closing SVG tag</svg>

Here's some rough code we are doing...

        try        {            using var managedStream = new MemoryStream();            using var stream = new SKManagedWStream(managedStream);            using var canvas = SKSvgCanvas.Create(bounds, stream);            using var theme = BuildTheme(ExportFormat.SVG);            using var skiaRenderer = await CreateSkiaRenderer(theme, file, CanvasSize, CanvasSize) as SkiaRenderer;            if (skiaRenderer == null) throw new ArgumentException("Renderer was null for SVG export");            canvas.DrawMeasurement(skiaRenderer, filename, file, CanvasSize, CanvasSize);            result.Data = managedStream.ToArray();             // Test is showing the missing tag...            var test = UTF8Encoding.Default.GetString(result.Data);        }        catch (Exception ex)        {            Logger.Singleton?.Error($"Error generating image {ex.Message}", ex);            return null;        }

Here's an example SVG generated

<?xml version="1.0" encoding="utf-8" ?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="1024"><rect fill="white" fill-opacity="0" transform="matrix(921.6 0 0 921.6 512 512)" width="1024" height="1024"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.329426 0.27043L-0.0102139 0.27043"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.0102139 0.27043L0.356656 0.266978"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M0.356656 0.266978L0.392068 0.0848129"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M0.392068 0.0848129L0.065085 0.0644476"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M0.065085 0.0644476L-0.175263 0.0421951"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.175263 0.0421951L-0.415 0.061054"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.415 0.061054L-0.330184 -0.120471"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.330184 -0.120471L-0.114145 -0.0884154"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.114145 -0.0884154L0.137283 -0.0631237"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M0.137283 -0.0631237L0.383638 -0.00445965"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M0.383638 -0.00445965L0.415 -0.105278"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M0.415 -0.105278L0.195069 -0.132355"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M0.195069 -0.132355L-0.0494226 -0.172486"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.0494226 -0.172486L-0.243783 -0.27043"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.243783 -0.27043L-0.406623 -0.0502675"/><path fill="none" stroke="black" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.406623 -0.0502675L-0.329426 0.27043"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.32942569" cy="0.27043012" rx="0.0086805522" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.010213852" cy="0.27043015" rx="0.008680556" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="0.35665649" cy="0.2669777" rx="0.0086805522" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="0.39206827" cy="0.08481288" rx="0.0086805522" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="0.065084994" cy="0.064447641" rx="0.0086805541" ry="0.0086805541"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.17526262" cy="0.042195067" rx="0.0086805522" ry="0.008680556"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.41499996" cy="0.061053976" rx="0.0086805522" ry="0.0086805541"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.33018407" cy="-0.12047133" rx="0.0086805522" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.11414509" cy="-0.088415354" rx="0.0086805522" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="0.137283" cy="-0.063123733" rx="0.0086805522" ry="0.0086805541"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="0.3836382" cy="-0.0044596493" rx="0.0086805522" ry="0.008680556"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="0.41500002" cy="-0.10527766" rx="0.0086805522" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="0.1950689" cy="-0.13235533" rx="0.0086805522" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.049422622" cy="-0.17248622" rx="0.008680556" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.24378324" cy="-0.27043012" rx="0.0086805597" ry="0.0086805522"/><ellipse transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.40662292" cy="-0.050267547" rx="0.0086805522" ry="0.008680556"/><ellipse fill="#0DD7B5" transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.32942569" cy="0.27043012" rx="0.0086805522" ry="0.0086805522"/><ellipse fill="#0DD7B5" transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.32942569" cy="0.27043012" rx="0.0086805522" ry="0.0086805522"/><path fill="none" stroke="red" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" stroke-opacity="0.50196081" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.329426 0.27043L-0.291384 0.27043"/><path fill="none" stroke="green" stroke-width="0.0054253475" stroke-linecap="round" stroke-miterlimit="4" stroke-opacity="0.50196081" transform="matrix(921.6 0 0 921.6 512 512)" d="M-0.329426 0.27043L-0.329426 0.232388"/><rect transform="matrix(921.6 0 0 921.6 512 512)" x="-0.33810624" y="0.26174957" width="0.017361104" height="0.017361104"/><ellipse fill="#0DD7B5" transform="matrix(921.6 0 0 921.6 512 512)" cx="-0.32942569" cy="0.27043012" rx="0.0086805522" ry="0.0086805522"/>

Image

Image

At first we thought maybe our rendering did something that the SVG generation just crashes on and stops, but looking into multiple examples we think its actually just always the missing close tag.

When we add the close tag it comes out as expected

Image

Expected Behavior

SVG data should have the ending close tag

Actual Behavior

Ending close tag is missing

Version of SkiaSharp

3.116.0 (Current)

Last Known Good Version of SkiaSharp

2.88.9 (Previous)

Platform / Operating System Version

Testing on Blazor + iOS via Rider (but occurs in release builds of web on all browsers)

NOTE: We are on SkiaSharp 3.119.0 (Github doesn't show this as an option in the dropdown)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp