Skip to content

Preserve type converters for aot/trimmer#3

Closed
maxkatz6 wants to merge 1 commit into
wieslawsoltes:masterfrom
maxkatz6:several-aot-attributes
Closed

Preserve type converters for aot/trimmer#3
maxkatz6 wants to merge 1 commit into
wieslawsoltes:masterfrom
maxkatz6:several-aot-attributes

Conversation

@maxkatz6
Copy link
Copy Markdown

This PR fixes several warnigns/erros that are reproducible during PublishAOT build with Svg.Skia library referenced:

    /_/externals/SVG/Source/DataTypes/SvgAspectRatio.cs(59): Trim analysis error IL2026: Svg.SvgAspectRatio.ToString(): 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.
    /_/externals/SVG/Source/DataTypes/SvgAspectRatio.cs(59): AOT analysis error IL3050: Svg.SvgAspectRatio.ToString(): Using member 'System.Enum.GetValues(Type)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. It might not be possible to create an array of the enum type at runtime. Use the GetValues<TEnum> overload or the GetValuesAsUnderlyingType method instead.

These special attributes fix the problem by ensuring attributes are statically linked, and not removed from the assembly. Without changing any logic.

@wieslawsoltes
Copy link
Copy Markdown
Owner

@maxkatz6 This need to go the upstream repository https://github.com/svg-net/SVG

@maxkatz6 maxkatz6 closed this Jul 21, 2025
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