Skip to content

Ensure svg model has no trimmer warnings - #551

Merged
wieslawsoltes merged 2 commits into
wieslawsoltes:masterfrom
OleRoss:feat/ensure-svg-model-has-no-trimmer-warnings
Aug 5, 2026
Merged

Ensure svg model has no trimmer warnings#551
wieslawsoltes merged 2 commits into
wieslawsoltes:masterfrom
OleRoss:feat/ensure-svg-model-has-no-trimmer-warnings

Conversation

@OleRoss

@OleRoss OleRoss commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Hi, first of all, thank you for this library.

I was running an AOT publish with a reference to Svg.Controls.Skia.Avalonia 2.0.0.13 which referenced Svg.Model 5.1.1 and got the following trimmer warnings:

    /_/src/Svg.Model/Services/TransformsService.cs(346): Trim analysis warning IL2026: Svg.Model.Services.TransformsService.TryResolveTransformOriginComponent(String,Boolean,SvgElement,SKRect,Single&): Using member 'System.ComponentModel.TypeDescriptor.GetConverter(Type)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.
    /_/src/Svg.Model/Services/SvgGeometryService.cs(197): Trim analysis warning IL2026: Svg.Model.Services.SvgGeometryService.GetComputedUnit(SvgElement,String,SvgUnit,Boolean,Boolean&,Boolean&,Boolean): Using member 'System.ComponentModel.TypeDescriptor.GetConverter(Type)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.

To fix this, I noticed that other code paths use SvgUnitConverter.Parse and decided to use this as a trimmer-safe alternative.

Additionally, I added AOT/Trimmer build properties to the relevant projects to ensure these errors are caught during normal builds in the future.

@wieslawsoltes
wieslawsoltes merged commit d648cb5 into wieslawsoltes:master Aug 5, 2026
11 checks passed
@OleRoss

OleRoss commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for merging!

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.

2 participants