Skip to content

Update SVG upstream and complete SkiaSharp 3 AOT cleanup#527

Merged
wieslawsoltes merged 9 commits into
masterfrom
codex/update-skia3-aot-svg-upstream
May 13, 2026
Merged

Update SVG upstream and complete SkiaSharp 3 AOT cleanup#527
wieslawsoltes merged 9 commits into
masterfrom
codex/update-skia3-aot-svg-upstream

Conversation

@wieslawsoltes
Copy link
Copy Markdown
Owner

Summary

This PR updates the SVG submodule to the latest upstream commit carrying the trim/AOT annotation cleanup and completes the downstream Svg.Skia changes needed to build against SkiaSharp 3 without runtime sampling reflection.

What Changed

  • Updated externals/SVG to upstream commit 853a9ae8, including the SVG library trim/AOT annotation cleanup from Remove DynamicallyAccessedMemberTypes to improve trim/aot compatibility svg-net/SVG#1211.
  • Moved central SkiaSharp package versions to stable 3.119.2.
  • Added build/SkiaSharp.Avalonia.props so direct SkiaSharp references in Avalonia sample/test apps stay aligned with the Avalonia.Skia 12.0.0 SkiaSharp 3.119.3-preview.1.1 dependency.
  • Removed the old SkiaSharp.v3.props and SkiaSharp.Native.v3.props split and normalized project imports.
  • Removed the reflected SkiaSharpSamplingOptionsApi bridge from SkiaModel.
  • Replaced image drawing, image-filter, and downsampling paths with statically referenced SkiaSharp 3 SKSamplingOptions APIs.
  • Updated generated Skia C# output for image filters to emit SkiaSharp 3 sampling options.
  • Removed remaining RequiresUnreferencedCode and DynamicallyAccessedMembers annotations from the reviewed runtime path.
  • Made animation value conversion avoid TypeDescriptor.GetConverter(Type) by reusing per-property converters captured from SVG descriptors and by handling common primitive/unit conversions directly.
  • Added raw JavaScript DOM attribute state preservation so DOM-assigned values such as SVGAngle.valueAsString keep their original unit spelling and survive DeepCopy().
  • Reworked generated SvgML enum bridge parsing/formatting to avoid TypeDescriptor.GetConverter while preserving SVG casing such as visiblePainted, whenNotActive, color-dodge, and hueRotate.
  • Added regression coverage for JavaScript DOM raw angle/empty-attribute state and SvgML enum bridge formatting/parsing.

Why

SkiaSharp 3 exposes the sampling API directly. Keeping the old runtime reflection bridge required AOT annotations and retained a trim-sensitive path. Moving to SkiaSharp 3 as the baseline lets Svg.Skia use the real static API surface while preserving framework-specific package constraints for Avalonia.

The SVG upstream update also changed enum/string conversion behavior in ways that affected JavaScript DOM compatibility. The new raw DOM attribute side table keeps script-observable string values distinct from typed model conversions.

Validation

  • dotnet format Svg.Skia.slnx --no-restore
  • dotnet build Svg.Skia.slnx -c Release
  • dotnet test Svg.Skia.slnx -c Release
  • dotnet build src/Svg.Controls.Skia.Maui/Svg.Controls.Skia.Maui.csproj -c Release
  • dotnet build src/SvgML.Maui/SvgML.Maui.csproj -c Release
  • git diff --check
  • rg -n "DynamicallyAccessedMembers|RequiresUnreferencedCode|RequiresDynamicCode|SkiaSharpSamplingOptionsApi" src externals/SVG -g '*.cs'

Notes

The full solution build/test still reports existing warnings only: known package advisories, nullable warnings, and SkiaSharp 3 text API obsoletions. The reviewed runtime paths no longer contain RequiresUnreferencedCode, DynamicallyAccessedMembers, or the SkiaSharp sampling reflection shim.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: afc704902c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.Custom/Animation/SvgDocument.Animation.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6c3e1e0d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.Custom/Compatibility/SvgElementFactory.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1576e2594

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant