Load inline SVG sources asynchronously#504
Merged
Merged
Conversation
This was referenced May 12, 2026
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary: Async Inline SVG Source Loading
Overview
This change addresses issue #439, where assigning a large inline SVG string to
Avalonia.Svg.Skia.Svg.Sourcecould block the UI thread while the SVG wasencoded, parsed, and converted into an
SvgSource.The issue reproduction uses a large Verovio-generated SVG. The same SVG renders
successfully through the command-line converter, which indicates that the file is
valid and that the visible problem in the Avalonia control is caused by
synchronous inline source loading on the UI thread rather than unsupported SVG
content.
Changes
Sourcevalues are now loaded asynchronously.Task.Run.SvgSourceafter parsing finishes.them.
the current source.
sources use the same
WireframeandDisableFiltersbehavior.so changes made while a large source is still parsing are preserved.
Tests
New control tests cover:
Sourceis assigned repeatedly.Validation
The issue attachment was downloaded and rendered through
Svg.Skia.Converter, producing a PNG successfully in about five seconds. Thisconfirmed that the attached SVG content can be parsed and rendered by the
library.
Commands run locally:
dotnet format Svg.Skia.slnx --no-restoredotnet format tests/Svg.Controls.Skia.Avalonia.UnitTests/Svg.Controls.Skia.Avalonia.UnitTests.csproj --no-restoregit diff --checkdotnet build src/Svg.Controls.Skia.Avalonia/Svg.Controls.Skia.Avalonia.csproj -c Release --no-restoredotnet test tests/Svg.Controls.Skia.Avalonia.UnitTests/Svg.Controls.Skia.Avalonia.UnitTests.csproj -c Release --no-restore --filter FullyQualifiedName~SvgControlTestsdotnet test tests/Svg.Controls.Skia.Avalonia.UnitTests/Svg.Controls.Skia.Avalonia.UnitTests.csproj -c Release --no-restoreNotes
The full solution build and full solution test suite were not rerun after the
final small render-options adjustment. The touched control project and its test
project were built and tested successfully.