diff --git a/Source/DataTypes/SvgAspectRatio.cs b/Source/DataTypes/SvgAspectRatio.cs index 89b70a41d..14bb2c0ec 100644 --- a/Source/DataTypes/SvgAspectRatio.cs +++ b/Source/DataTypes/SvgAspectRatio.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using Svg.DataTypes; namespace Svg @@ -54,6 +55,11 @@ public object Clone() return MemberwiseClone(); } +#if NET6_0_OR_GREATER + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(SvgPreserveAspectRatioConverter))] + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "DynamicDependency keeps converter safe")] + [UnconditionalSuppressMessage("AOT", "IL3050")] +#endif public override string ToString() { return TypeDescriptor.GetConverter(typeof(SvgPreserveAspectRatio)).ConvertToString(this.Align) + (Slice ? " slice" : ""); diff --git a/Source/DataTypes/SvgPoint.cs b/Source/DataTypes/SvgPoint.cs index 912919ffc..00d745e3a 100644 --- a/Source/DataTypes/SvgPoint.cs +++ b/Source/DataTypes/SvgPoint.cs @@ -1,4 +1,6 @@ using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using Svg.DataTypes; namespace Svg { @@ -39,12 +41,16 @@ public override int GetHashCode() return base.GetHashCode(); } +#if NET6_0_OR_GREATER + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(SvgUnitConverter))] + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "DynamicDependency keeps converter safe")] +#endif public SvgPoint(string x, string y) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(SvgUnit)); - this.x = (SvgUnit)converter.ConvertFrom(x); - this.y = (SvgUnit)converter.ConvertFrom(y); + this.x = (SvgUnit)converter.ConvertFrom(x)!; + this.y = (SvgUnit)converter.ConvertFrom(y)!; } public SvgPoint(SvgUnit x, SvgUnit y)