From e8765b5a809b1e4f562ead3202600e4c4952b660 Mon Sep 17 00:00:00 2001 From: Lakshan Fernando Date: Tue, 9 Apr 2024 08:19:23 -0700 Subject: [PATCH 1/3] Removing RUC from Default and Ambient attributes --- .../ref/System.ComponentModel.TypeConverter.cs | 1 - .../src/System/ComponentModel/AmbientValueAttribute.cs | 2 +- .../src/System/ComponentModel/DefaultValueAttribute.cs | 6 +++--- src/libraries/System.Runtime/ref/System.Runtime.cs | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs index fb53eb78bfc8af..62a2b4d7fb7376 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs @@ -38,7 +38,6 @@ public AmbientValueAttribute(long value) { } public AmbientValueAttribute(object? value) { } public AmbientValueAttribute(float value) { } public AmbientValueAttribute(string? value) { } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")] public AmbientValueAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, string value) { } public object? Value { get { throw null; } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs index 53a43204668305..6e3a82e181f2fa 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs @@ -24,7 +24,7 @@ public sealed class AmbientValueAttribute : Attribute /// specified value to the specified type, and using the U.S. English culture as the /// translation context. /// - [RequiresUnreferencedCode(TypeConverter.RequiresUnreferencedCodeMessage)] + [UnconditionalSuppressMessage("Trimming", "IL2026:", Justification = "Trimming doesn't support AmbientValueAttribute being used at runtime")] public AmbientValueAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string value) { // The try/catch here is because attributes should never throw exceptions. We would fail to diff --git a/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs index 322a6ae242b051..190f47b1ba234b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs @@ -31,7 +31,6 @@ public class DefaultValueAttribute : Attribute /// class, converting the specified value to the specified type, and using the U.S. English /// culture as the translation context. /// - [RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")] public DefaultValueAttribute( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string? value) @@ -39,9 +38,9 @@ public DefaultValueAttribute( // The null check and try/catch here are because attributes should never throw exceptions. // We would fail to load an otherwise normal class. + Debug.Assert(!IsSupported, "Runtime instantiation of this attribute is not allowed."); if (!IsSupported) { - Debug.Assert(!IsSupported, "Runtime instantiation of this attribute is not allowed."); return; } @@ -69,8 +68,9 @@ public DefaultValueAttribute( _value = Convert.ChangeType(value, type, CultureInfo.InvariantCulture); } - [RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")] // Looking for ad hoc created TypeDescriptor.ConvertFromInvariantString(Type, string) + [UnconditionalSuppressMessage("Trimming", "IL2026:", Justification = "Trimming doesn't support DefaulttValueAttribute being used at runtime")] + [UnconditionalSuppressMessage("Trimming", "IL2111:", Justification = "Trimming doesn't support DefaulttValueAttribute being used at runtime")] static bool TryConvertFromInvariantString( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type typeToConvert, string? stringValue, diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 0371e3037e2653..f4ec5dd7592176 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -8047,7 +8047,6 @@ public DefaultValueAttribute(object? value) { } public DefaultValueAttribute(sbyte value) { } public DefaultValueAttribute(float value) { } public DefaultValueAttribute(string? value) { } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")] public DefaultValueAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, string? value) { } [System.CLSCompliantAttribute(false)] public DefaultValueAttribute(ushort value) { } From 5185fad394441157619104d17e5f9b54bd71b9f1 Mon Sep 17 00:00:00 2001 From: Lakshan Fernando Date: Thu, 11 Apr 2024 08:07:24 -0700 Subject: [PATCH 2/3] FB --- docs/workflow/trimming/feature-switches.md | 2 ++ .../ref/System.ComponentModel.TypeConverter.cs | 1 + .../src/System/ComponentModel/AmbientValueAttribute.cs | 3 ++- .../src/System/ComponentModel/DefaultValueAttribute.cs | 5 ++--- src/libraries/System.Runtime/ref/System.Runtime.cs | 1 + .../src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets | 2 ++ 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/workflow/trimming/feature-switches.md b/docs/workflow/trimming/feature-switches.md index 2c25a36230d4d2..a205afa50911a4 100644 --- a/docs/workflow/trimming/feature-switches.md +++ b/docs/workflow/trimming/feature-switches.md @@ -35,6 +35,8 @@ configurations but their defaults might vary as any SDK can set the defaults dif | JsonSerializerIsReflectionEnabledByDefault | System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault | When set to false, disables using reflection as the default contract resolver in System.Text.Json | | EnableGeneratedComInterfaceComImportInterop | System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop | When set to true, enables casting source-generated COM object wrappers to built-in COM-based COM interfaces. | | _UseManagedNtlm | System.Net.Security.UseManagedNtlm | When set to true, uses built-in managed implementation of NTLM and SPNEGO algorithm for HTTP, SMTP authentication, and NegotiateAuthentication API instead of system provided GSSAPI implementation. | +| _DesignerHostSupport | System.ComponentModel.Design.IDesignerHost.IsSupported | When set to true, supports creating design components at runtime. | +| _DefaultValueAttributeSupport | System.ComponentModel.DefaultValueAttribute.IsSupported | When set to true, supports creating a DefaultValueAttribute at runtime. | Any feature-switch which defines property can be set in csproj file or on the command line as any other MSBuild property. Those without predefined property name diff --git a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs index 62a2b4d7fb7376..f8ebfcc800a474 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs @@ -38,6 +38,7 @@ public AmbientValueAttribute(long value) { } public AmbientValueAttribute(object? value) { } public AmbientValueAttribute(float value) { } public AmbientValueAttribute(string? value) { } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("AmbientValueAttribute usage of TypeConverter is not compatible with trimming.")] public AmbientValueAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, string value) { } public object? Value { get { throw null; } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs index 6e3a82e181f2fa..7f1d65bfc394e0 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs @@ -24,12 +24,13 @@ public sealed class AmbientValueAttribute : Attribute /// specified value to the specified type, and using the U.S. English culture as the /// translation context. /// - [UnconditionalSuppressMessage("Trimming", "IL2026:", Justification = "Trimming doesn't support AmbientValueAttribute being used at runtime")] + [RequiresUnreferencedCode("AmbientValueAttribute usage of TypeConverter is not compatible with trimming.")] public AmbientValueAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string value) { // The try/catch here is because attributes should never throw exceptions. We would fail to // load an otherwise normal class. + Debug.Assert(IDesignerHost.IsSupported, "Runtime instantiation of this attribute is not allowed with trimming."); if (!IDesignerHost.IsSupported) { return; diff --git a/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs index 190f47b1ba234b..202fe0cce94424 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs @@ -31,6 +31,7 @@ public class DefaultValueAttribute : Attribute /// class, converting the specified value to the specified type, and using the U.S. English /// culture as the translation context. /// + [RequiresUnreferencedCode("DefaultValueAttribute usage of TypeConverter is not compatible with trimming.")] public DefaultValueAttribute( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string? value) @@ -38,7 +39,7 @@ public DefaultValueAttribute( // The null check and try/catch here are because attributes should never throw exceptions. // We would fail to load an otherwise normal class. - Debug.Assert(!IsSupported, "Runtime instantiation of this attribute is not allowed."); + Debug.Assert(IsSupported, "Runtime instantiation of this attribute is not allowed with trimming."); if (!IsSupported) { return; @@ -69,8 +70,6 @@ public DefaultValueAttribute( } // Looking for ad hoc created TypeDescriptor.ConvertFromInvariantString(Type, string) - [UnconditionalSuppressMessage("Trimming", "IL2026:", Justification = "Trimming doesn't support DefaulttValueAttribute being used at runtime")] - [UnconditionalSuppressMessage("Trimming", "IL2111:", Justification = "Trimming doesn't support DefaulttValueAttribute being used at runtime")] static bool TryConvertFromInvariantString( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type typeToConvert, string? stringValue, diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index f4ec5dd7592176..c97ffcd70a997b 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -8047,6 +8047,7 @@ public DefaultValueAttribute(object? value) { } public DefaultValueAttribute(sbyte value) { } public DefaultValueAttribute(float value) { } public DefaultValueAttribute(string? value) { } + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("DefaultValueAttribute usage of TypeConverter is not compatible with trimming.")] public DefaultValueAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, string? value) { } [System.CLSCompliantAttribute(false)] public DefaultValueAttribute(ushort value) { } diff --git a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets index bac804e1e1d493..daa4eab8e7003c 100644 --- a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets +++ b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets @@ -52,6 +52,8 @@ Copyright (c) .NET Foundation. All rights reserved. <_UseManagedNtlm Condition="'$(_UseManagedNtlm)' == '' and $(RuntimeIdentifier.StartsWith('linux-bionic'))">true <_UseManagedNtlm Condition="'$(_UseManagedNtlm)' == '' and $(RuntimeIdentifier.StartsWith('linux'))">false + <_DesignerHostSupport Condition="'$(_DesignerHostSupport)' == ''">false + <_DefaultValueAttributeSupport Condition="'$(_DefaultValueAttributeSupport)' == ''">false From 81b1f1ac291b0f709eba78b2dfe0f18164b24feb Mon Sep 17 00:00:00 2001 From: Lakshan Fernando Date: Fri, 12 Apr 2024 16:04:16 -0700 Subject: [PATCH 3/3] FB2 --- .../ref/System.ComponentModel.TypeConverter.cs | 1 - .../src/ILLink/ILLink.Suppressions.LibraryBuild.xml | 7 +++++++ .../src/System/ComponentModel/AmbientValueAttribute.cs | 6 ++++-- .../src/System/ComponentModel/Design/IDesignerHost.cs | 3 +++ .../src/ILLink/ILLink.Suppressions.LibraryBuild.xml | 7 +++++++ .../src/System/ComponentModel/DefaultValueAttribute.cs | 5 ++++- src/libraries/System.Runtime/ref/System.Runtime.cs | 1 - 7 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs index f8ebfcc800a474..62a2b4d7fb7376 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs @@ -38,7 +38,6 @@ public AmbientValueAttribute(long value) { } public AmbientValueAttribute(object? value) { } public AmbientValueAttribute(float value) { } public AmbientValueAttribute(string? value) { } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("AmbientValueAttribute usage of TypeConverter is not compatible with trimming.")] public AmbientValueAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, string value) { } public object? Value { get { throw null; } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.Suppressions.LibraryBuild.xml b/src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.Suppressions.LibraryBuild.xml index aac20beb79bab5..e796cac8f444c5 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.Suppressions.LibraryBuild.xml +++ b/src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.Suppressions.LibraryBuild.xml @@ -22,5 +22,12 @@ M:System.ComponentModel.TypeDescriptor.NodeFor(System.Object,System.Boolean) This warning is left in the product so developers get an ILLink warning when trimming an app with System.ComponentModel.TypeDescriptor.IsComObjectDescriptorSupported=true. + + ILLink + IL2026 + member + M:System.ComponentModel.AmbientValueAttribute.#ctor(System.Type,System.String) + This warning is left in the product so developers get an ILLink warning when trimming an app with System.ComponentModel.Design.IDesignerHost.IsSupported=true. + diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs index 7f1d65bfc394e0..ae52e7ebc93846 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/AmbientValueAttribute.cs @@ -24,7 +24,6 @@ public sealed class AmbientValueAttribute : Attribute /// specified value to the specified type, and using the U.S. English culture as the /// translation context. /// - [RequiresUnreferencedCode("AmbientValueAttribute usage of TypeConverter is not compatible with trimming.")] public AmbientValueAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string value) { // The try/catch here is because attributes should never throw exceptions. We would fail to @@ -38,7 +37,10 @@ public AmbientValueAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemb try { - _value = TypeDescriptor.GetConverter(type).ConvertFromInvariantString(value); + _value = TypeDescriptorGetConverter(type).ConvertFromInvariantString(value); + + [RequiresUnreferencedCode("AmbientValueAttribute usage of TypeConverter is not compatible with trimming.")] + static TypeConverter TypeDescriptorGetConverter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type) => TypeDescriptor.GetConverter(type); } catch { diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IDesignerHost.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IDesignerHost.cs index 8ab34614a7ebde..46dbae0a74d49c 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IDesignerHost.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IDesignerHost.cs @@ -12,7 +12,10 @@ namespace System.ComponentModel.Design public interface IDesignerHost : IServiceContainer { [FeatureSwitchDefinition("System.ComponentModel.Design.IDesignerHost.IsSupported")] + [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] +#pragma warning disable IL4000 internal static bool IsSupported => AppContext.TryGetSwitch("System.ComponentModel.Design.IDesignerHost.IsSupported", out bool isSupported) ? isSupported : true; +#pragma warning restore IL4000 /// /// Gets or sets a value indicating whether the designer host diff --git a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.LibraryBuild.xml b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.LibraryBuild.xml index 278ed933f07043..c0523c4d646dc0 100644 --- a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.LibraryBuild.xml +++ b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.LibraryBuild.xml @@ -22,5 +22,12 @@ M:System.StartupHookProvider.ProcessStartupHooks(System.String) This warning is left in the product so developers get an ILLink warning when trimming an app with System.StartupHookProvider.IsSupported=true. + + ILLink + IL2026 + member + M:System.ComponentModel.DefaultValueAttribute.#ctor(System.Type,System.String) + This warning is left in the product so developers get an ILLink warning when trimming an app with System.ComponentModel.DefaultValueAttribute.IsSupported=true. + diff --git a/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs index 202fe0cce94424..3ab01cee369168 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs @@ -24,14 +24,16 @@ public class DefaultValueAttribute : Attribute private static object? s_convertFromInvariantString; [FeatureSwitchDefinition("System.ComponentModel.DefaultValueAttribute.IsSupported")] + [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] +#pragma warning disable IL4000 internal static bool IsSupported => AppContext.TryGetSwitch("System.ComponentModel.DefaultValueAttribute.IsSupported", out bool isSupported) ? isSupported : true; +#pragma warning restore IL4000 /// /// Initializes a new instance of the /// class, converting the specified value to the specified type, and using the U.S. English /// culture as the translation context. /// - [RequiresUnreferencedCode("DefaultValueAttribute usage of TypeConverter is not compatible with trimming.")] public DefaultValueAttribute( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string? value) @@ -69,6 +71,7 @@ public DefaultValueAttribute( _value = Convert.ChangeType(value, type, CultureInfo.InvariantCulture); } + [RequiresUnreferencedCode("DefaultValueAttribute usage of TypeConverter is not compatible with trimming.")] // Looking for ad hoc created TypeDescriptor.ConvertFromInvariantString(Type, string) static bool TryConvertFromInvariantString( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type typeToConvert, diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index c97ffcd70a997b..f4ec5dd7592176 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -8047,7 +8047,6 @@ public DefaultValueAttribute(object? value) { } public DefaultValueAttribute(sbyte value) { } public DefaultValueAttribute(float value) { } public DefaultValueAttribute(string? value) { } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("DefaultValueAttribute usage of TypeConverter is not compatible with trimming.")] public DefaultValueAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, string? value) { } [System.CLSCompliantAttribute(false)] public DefaultValueAttribute(ushort value) { }