diff --git a/src/libraries/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.cs b/src/libraries/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.cs
index c4b69c84f1e742..45d664d1ddf63e 100644
--- a/src/libraries/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.cs
+++ b/src/libraries/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.cs
@@ -89,12 +89,14 @@ public DescriptionAttribute(string description) { }
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=true)]
public sealed partial class DesignerAttribute : System.Attribute
{
- public DesignerAttribute(string designerTypeName) { }
- public DesignerAttribute(string designerTypeName, string designerBaseTypeName) { }
- public DesignerAttribute(string designerTypeName, System.Type designerBaseType) { }
- public DesignerAttribute(System.Type designerType) { }
- public DesignerAttribute(System.Type designerType, System.Type designerBaseType) { }
+ public DesignerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string designerTypeName) { }
+ public DesignerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string designerTypeName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string designerBaseTypeName) { }
+ public DesignerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string designerTypeName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] System.Type designerBaseType) { }
+ public DesignerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] System.Type designerType) { }
+ public DesignerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] System.Type designerType, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] System.Type designerBaseType) { }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public string DesignerBaseTypeName { get { throw null; } }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public string DesignerTypeName { get { throw null; } }
public override object TypeId { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
@@ -162,10 +164,12 @@ public DisplayNameAttribute(string displayName) { }
public sealed partial class EditorAttribute : System.Attribute
{
public EditorAttribute() { }
- public EditorAttribute(string typeName, string? baseTypeName) { }
- public EditorAttribute(string typeName, System.Type baseType) { }
- public EditorAttribute(System.Type type, System.Type baseType) { }
+ public EditorAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] string typeName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] string? baseTypeName) { }
+ public EditorAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] string typeName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type baseType) { }
+ public EditorAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type baseType) { }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public string? EditorBaseTypeName { get { throw null; } }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public string EditorTypeName { get { throw null; } }
public override object TypeId { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
diff --git a/src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/DesignerAttribute.cs b/src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/DesignerAttribute.cs
index bde0162bbdf0f4..51472cdeed5b6b 100644
--- a/src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/DesignerAttribute.cs
+++ b/src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/DesignerAttribute.cs
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using System.ComponentModel.Design;
+using System.Diagnostics.CodeAnalysis;
namespace System.ComponentModel
{
@@ -17,7 +17,7 @@ public sealed class DesignerAttribute : Attribute
/// Initializes a new instance of the class using the name of the type that
/// provides design-time services.
///
- public DesignerAttribute(string designerTypeName)
+ public DesignerAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string designerTypeName)
{
DesignerTypeName = designerTypeName ?? throw new ArgumentNullException(nameof(designerTypeName));
DesignerBaseTypeName = "System.ComponentModel.Design.IDesigner, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
@@ -27,7 +27,7 @@ public DesignerAttribute(string designerTypeName)
/// Initializes a new instance of the class using the type that provides
/// design-time services.
///
- public DesignerAttribute(Type designerType)
+ public DesignerAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type designerType)
{
if (designerType == null)
{
@@ -42,7 +42,9 @@ public DesignerAttribute(Type designerType)
/// Initializes a new instance of the class using the designer type and the
/// base class for the designer.
///
- public DesignerAttribute(string designerTypeName, string designerBaseTypeName)
+ public DesignerAttribute(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string designerTypeName,
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string designerBaseTypeName)
{
DesignerTypeName = designerTypeName ?? throw new ArgumentNullException(nameof(designerTypeName));
DesignerBaseTypeName = designerBaseTypeName;
@@ -52,7 +54,9 @@ public DesignerAttribute(string designerTypeName, string designerBaseTypeName)
/// Initializes a new instance of the class, using the name of the designer
/// class and the base class for the designer.
///
- public DesignerAttribute(string designerTypeName, Type designerBaseType)
+ public DesignerAttribute(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string designerTypeName,
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type designerBaseType)
{
if (designerTypeName == null)
{
@@ -71,7 +75,9 @@ public DesignerAttribute(string designerTypeName, Type designerBaseType)
/// Initializes a new instance of the class using the types of the designer and
/// designer base class.
///
- public DesignerAttribute(Type designerType, Type designerBaseType)
+ public DesignerAttribute(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type designerType,
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type designerBaseType)
{
if (designerType == null)
{
@@ -89,11 +95,14 @@ public DesignerAttribute(Type designerType, Type designerBaseType)
///
/// Gets the name of the base type of this designer.
///
+ // Using PublicParameterlessConstructor to preserve the type. See https://github.com/mono/linker/issues/1878
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public string DesignerBaseTypeName { get; }
///
/// Gets the name of the designer type associated with this designer attribute.
///
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public string DesignerTypeName { get; }
///
diff --git a/src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/EditorAttribute.cs b/src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/EditorAttribute.cs
index d1f3e27f7c7779..ce23595bc2b1cb 100644
--- a/src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/EditorAttribute.cs
+++ b/src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/EditorAttribute.cs
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
+
namespace System.ComponentModel
{
///
@@ -25,7 +27,9 @@ public EditorAttribute()
/// Initializes a new instance of the class with the type name and base type
/// name of the editor.
///
- public EditorAttribute(string typeName, string? baseTypeName)
+ public EditorAttribute(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] string typeName,
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] string? baseTypeName)
{
EditorTypeName = typeName ?? throw new ArgumentNullException(nameof(typeName));
EditorBaseTypeName = baseTypeName;
@@ -34,7 +38,9 @@ public EditorAttribute(string typeName, string? baseTypeName)
///
/// Initializes a new instance of the class.
///
- public EditorAttribute(string typeName, Type baseType)
+ public EditorAttribute(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] string typeName,
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type baseType)
{
if (typeName == null)
{
@@ -52,7 +58,9 @@ public EditorAttribute(string typeName, Type baseType)
///
/// Initializes a new instance of the class.
///
- public EditorAttribute(Type type, Type baseType)
+ public EditorAttribute(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type,
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type baseType)
{
if (type == null)
{
@@ -70,11 +78,13 @@ public EditorAttribute(Type type, Type baseType)
///
/// Gets the name of the base class or interface serving as a lookup key for this editor.
///
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
public string? EditorBaseTypeName { get; }
///
/// Gets the name of the editor class.
///
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
public string EditorTypeName { get; }
///
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 29397fc17ead12..5782cac664427f 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs
@@ -287,6 +287,7 @@ protected CustomTypeDescriptor(System.ComponentModel.ICustomTypeDescriptor paren
public virtual System.ComponentModel.TypeConverter GetConverter() { throw null; }
public virtual System.ComponentModel.EventDescriptor GetDefaultEvent() { throw null; }
public virtual System.ComponentModel.PropertyDescriptor GetDefaultProperty() { throw null; }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Editors registered in TypeDescriptor.AddEditorTable may be trimmed.")]
public virtual object GetEditor(System.Type editorBaseType) { throw null; }
public virtual System.ComponentModel.EventDescriptorCollection GetEvents() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
@@ -565,6 +566,7 @@ public partial interface ICustomTypeDescriptor
System.ComponentModel.TypeConverter GetConverter();
System.ComponentModel.EventDescriptor GetDefaultEvent();
System.ComponentModel.PropertyDescriptor GetDefaultProperty();
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Editors registered in TypeDescriptor.AddEditorTable may be trimmed.")]
object GetEditor(System.Type editorBaseType);
System.ComponentModel.EventDescriptorCollection GetEvents();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
@@ -628,8 +630,9 @@ public enum InheritanceLevel
[System.AttributeUsageAttribute(System.AttributeTargets.Class)]
public partial class InstallerTypeAttribute : System.Attribute
{
- public InstallerTypeAttribute(string typeName) { }
- public InstallerTypeAttribute(System.Type installerType) { }
+ public InstallerTypeAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] string typeName) { }
+ public InstallerTypeAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type installerType) { }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public virtual System.Type InstallerType { get { throw null; } }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
@@ -704,9 +707,9 @@ internal LicenseManager() { }
public static System.ComponentModel.LicenseContext CurrentContext { get { throw null; } set { } }
public static System.ComponentModel.LicenseUsageMode UsageMode { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
- public static object CreateWithContext(System.Type type, System.ComponentModel.LicenseContext creationContext) { throw null; }
+ public static object CreateWithContext([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, System.ComponentModel.LicenseContext creationContext) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
- public static object CreateWithContext(System.Type type, System.ComponentModel.LicenseContext creationContext, object[] args) { throw null; }
+ public static object CreateWithContext([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, System.ComponentModel.LicenseContext creationContext, object[] args) { throw null; }
public static bool IsLicensed(System.Type type) { throw null; }
public static bool IsValid(System.Type type) { throw null; }
public static bool IsValid(System.Type type, object instance, out System.ComponentModel.License license) { throw null; }
@@ -725,8 +728,9 @@ public sealed partial class LicenseProviderAttribute : System.Attribute
{
public static readonly System.ComponentModel.LicenseProviderAttribute Default;
public LicenseProviderAttribute() { }
- public LicenseProviderAttribute(string typeName) { }
- public LicenseProviderAttribute(System.Type type) { }
+ public LicenseProviderAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string typeName) { }
+ public LicenseProviderAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] System.Type type) { }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public System.Type LicenseProvider { get { throw null; } }
public override object TypeId { get { throw null; } }
public override bool Equals(object value) { throw null; }
@@ -1040,7 +1044,7 @@ protected PropertyDescriptor(string name, System.Attribute[] attrs) : base (defa
public virtual bool SupportsChangeEvents { get { throw null; } }
public virtual void AddValueChanged(object component, System.EventHandler handler) { }
public abstract bool CanResetValue(object component);
- protected object CreateInstance(System.Type type) { throw null; }
+ protected object CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type) { throw null; }
public override bool Equals(object obj) { throw null; }
protected override void FillAttributes(System.Collections.IList attributeList) { }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The PropertyDescriptor's PropertyType cannot be statically discovered.")]
@@ -1051,11 +1055,12 @@ protected override void FillAttributes(System.Collections.IList attributeList) {
public System.ComponentModel.PropertyDescriptorCollection GetChildProperties(object instance) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The PropertyDescriptor's PropertyType cannot be statically discovered. The Type of instance cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
public virtual System.ComponentModel.PropertyDescriptorCollection GetChildProperties(object instance, System.Attribute[] filter) { throw null; }
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The PropertyDescriptor's PropertyType cannot be statically discovered.")]
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Editors registered in TypeDescriptor.AddEditorTable may be trimmed. The PropertyDescriptor's PropertyType cannot be statically discovered.")]
public virtual object GetEditor(System.Type editorBaseType) { throw null; }
public override int GetHashCode() { throw null; }
protected override object GetInvocationTarget(System.Type type, object instance) { throw null; }
- protected System.Type GetTypeFromName(string typeName) { throw null; }
+ [return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
+ protected System.Type GetTypeFromName([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] string typeName) { throw null; }
public abstract object GetValue(object component);
protected internal System.EventHandler GetValueChangedHandler(object component) { throw null; }
protected virtual void OnValueChanged(object component, System.EventArgs e) { }
@@ -1117,8 +1122,8 @@ void System.Collections.IList.RemoveAt(int index) { }
public partial class PropertyTabAttribute : System.Attribute
{
public PropertyTabAttribute() { }
- public PropertyTabAttribute(string tabClassName) { }
- public PropertyTabAttribute(string tabClassName, System.ComponentModel.PropertyTabScope tabScope) { }
+ public PropertyTabAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string tabClassName) { }
+ public PropertyTabAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string tabClassName, System.ComponentModel.PropertyTabScope tabScope) { }
public PropertyTabAttribute(System.Type tabClass) { }
public PropertyTabAttribute(System.Type tabClass, System.ComponentModel.PropertyTabScope tabScope) { }
public System.Type[] TabClasses { get { throw null; } }
@@ -1127,6 +1132,7 @@ public PropertyTabAttribute(System.Type tabClass, System.ComponentModel.Property
public bool Equals(System.ComponentModel.PropertyTabAttribute other) { throw null; }
public override bool Equals(object other) { throw null; }
public override int GetHashCode() { throw null; }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Types referenced by tabClassNames may be trimmed.")]
protected void InitializeArrays(string[] tabClassNames, System.ComponentModel.PropertyTabScope[] tabScopes) { }
protected void InitializeArrays(System.Type[] tabClasses, System.ComponentModel.PropertyTabScope[] tabScopes) { }
}
@@ -1140,9 +1146,10 @@ public enum PropertyTabScope
[System.AttributeUsageAttribute(System.AttributeTargets.Class, AllowMultiple=true)]
public sealed partial class ProvidePropertyAttribute : System.Attribute
{
- public ProvidePropertyAttribute(string propertyName, string receiverTypeName) { }
- public ProvidePropertyAttribute(string propertyName, System.Type receiverType) { }
+ public ProvidePropertyAttribute(string propertyName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string receiverTypeName) { }
+ public ProvidePropertyAttribute(string propertyName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] System.Type receiverType) { }
public string PropertyName { get { throw null; } }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public string ReceiverTypeName { get { throw null; } }
public override object TypeId { get { throw null; } }
public override bool Equals(object obj) { throw null; }
@@ -1236,9 +1243,11 @@ public partial class ToolboxItemAttribute : System.Attribute
public static readonly System.ComponentModel.ToolboxItemAttribute Default;
public static readonly System.ComponentModel.ToolboxItemAttribute None;
public ToolboxItemAttribute(bool defaultType) { }
- public ToolboxItemAttribute(string toolboxItemTypeName) { }
- public ToolboxItemAttribute(System.Type toolboxItemType) { }
+ public ToolboxItemAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] string toolboxItemTypeName) { }
+ public ToolboxItemAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type toolboxItemType) { }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Type ToolboxItemType { get { throw null; } }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public string ToolboxItemTypeName { get { throw null; } }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
@@ -1334,7 +1343,7 @@ public abstract partial class TypeDescriptionProvider
{
protected TypeDescriptionProvider() { }
protected TypeDescriptionProvider(System.ComponentModel.TypeDescriptionProvider parent) { }
- public virtual object CreateInstance(System.IServiceProvider provider, System.Type objectType, System.Type[] argTypes, object[] args) { throw null; }
+ public virtual object CreateInstance(System.IServiceProvider provider, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type objectType, System.Type[] argTypes, object[] args) { throw null; }
public virtual System.Collections.IDictionary GetCache(object instance) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public virtual System.ComponentModel.ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance) { throw null; }
@@ -1368,6 +1377,7 @@ public static event System.ComponentModel.RefreshEventHandler Refreshed { add {
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
public static System.ComponentModel.TypeDescriptionProvider AddAttributes(System.Type type, params System.Attribute[] attributes) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Types specified in table may be trimmed, or have their static construtors trimmed.")]
public static void AddEditorTable(System.Type editorBaseType, System.Collections.Hashtable table) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
public static void AddProvider(System.ComponentModel.TypeDescriptionProvider provider, object instance) { }
@@ -1383,7 +1393,7 @@ public static void CreateAssociation(object primary, object secondary) { }
public static System.ComponentModel.Design.IDesigner CreateDesigner(System.ComponentModel.IComponent component, System.Type designerBaseType) { throw null; }
public static System.ComponentModel.EventDescriptor CreateEvent(System.Type componentType, System.ComponentModel.EventDescriptor oldEventDescriptor, params System.Attribute[] attributes) { throw null; }
public static System.ComponentModel.EventDescriptor CreateEvent(System.Type componentType, string name, System.Type type, params System.Attribute[] attributes) { throw null; }
- public static object CreateInstance(System.IServiceProvider provider, System.Type objectType, System.Type[] argTypes, object[] args) { throw null; }
+ public static object CreateInstance(System.IServiceProvider provider, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type objectType, System.Type[] argTypes, object[] args) { throw null; }
public static System.ComponentModel.PropertyDescriptor CreateProperty([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type componentType, System.ComponentModel.PropertyDescriptor oldPropertyDescriptor, params System.Attribute[] attributes) { throw null; }
public static System.ComponentModel.PropertyDescriptor CreateProperty([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type componentType, string name, System.Type type, params System.Attribute[] attributes) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
@@ -1423,11 +1433,12 @@ public static void CreateAssociation(object primary, object secondary) { }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of component cannot be statically discovered.")]
public static System.ComponentModel.PropertyDescriptor GetDefaultProperty(object component, bool noCustomTypeDesc) { throw null; }
public static System.ComponentModel.PropertyDescriptor GetDefaultProperty([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type componentType) { throw null; }
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of component cannot be statically discovered.")]
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Editors registered in TypeDescriptor.AddEditorTable may be trimmed. The Type of component cannot be statically discovered.")]
public static object GetEditor(object component, System.Type editorBaseType) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of component cannot be statically discovered.")]
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Editors registered in TypeDescriptor.AddEditorTable may be trimmed. The Type of component cannot be statically discovered.")]
public static object GetEditor(object component, System.Type editorBaseType, bool noCustomTypeDesc) { throw null; }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Editors registered in TypeDescriptor.AddEditorTable may be trimmed.")]
public static object GetEditor([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, System.Type editorBaseType) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of component cannot be statically discovered.")]
public static System.ComponentModel.EventDescriptorCollection GetEvents(object component) { throw null; }
@@ -1923,9 +1934,12 @@ public partial interface ITypeResolutionService
System.Reflection.Assembly GetAssembly(System.Reflection.AssemblyName name);
System.Reflection.Assembly GetAssembly(System.Reflection.AssemblyName name, bool throwOnError);
string GetPathOfAssembly(System.Reflection.AssemblyName name);
- System.Type GetType(string name);
- System.Type GetType(string name, bool throwOnError);
- System.Type GetType(string name, bool throwOnError, bool ignoreCase);
+ [return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
+ System.Type GetType([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string name);
+ [return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
+ System.Type GetType([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string name, bool throwOnError);
+ [return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
+ System.Type GetType([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string name, bool throwOnError, bool ignoreCase);
void ReferenceAssembly(System.Reflection.AssemblyName name);
}
public partial class MenuCommand
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.Suppressions.xml b/src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.Suppressions.xml
index 558d9f107eb5a0..66fca33d8cb89b 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.Suppressions.xml
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.Suppressions.xml
@@ -1,168 +1,24 @@
-
- ILLink
- IL2026
- member
- M:System.ComponentModel.PropertyDescriptor.GetTypeFromName(System.String)
-
-
- ILLink
- IL2026
- member
- M:System.ComponentModel.PropertyTabAttribute.get_TabClasses
-
-
- ILLink
- IL2026
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetTypeFromName(System.String)
-
-
- ILLink
- IL2026
- member
- M:System.ComponentModel.TypeDescriptor.ComNativeDescriptorProxy.#ctor
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.InstallerTypeAttribute.get_InstallerType
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.LicenseProviderAttribute.get_LicenseProvider
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.PropertyDescriptor.GetTypeFromName(System.String)
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.PropertyTabAttribute.get_TabClasses
-
ILLink
IL2057
member
M:System.ComponentModel.ReflectPropertyDescriptor.FillAttributes(System.Collections.IList)
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.GetIntrinsicTypeEditor(System.Collections.Hashtable,System.Type)
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.GetTypeFromName(System.String)
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetEditorAttribute(System.ComponentModel.AttributeCollection,System.Type)
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetTypeFromName(System.String)
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.ToolboxItemAttribute.get_ToolboxItemType
-
-
- ILLink
- IL2057
- member
- M:System.ComponentModel.TypeDescriptor.CreateDesigner(System.ComponentModel.IComponent,System.Type)
-
-
- ILLink
- IL2059
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.GetEditorTable(System.Type)
-
-
- ILLink
- IL2067
- member
- M:System.ComponentModel.LicenseManager.CreateWithContext(System.Type,System.ComponentModel.LicenseContext,System.Object[])
-
-
- ILLink
- IL2067
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(System.IServiceProvider,System.Type,System.Type[],System.Object[])
-
-
- ILLink
- IL2067
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(System.Type,System.Type)
-
-
- ILLink
- IL2067
- member
- M:System.ComponentModel.TypeDescriptionProvider.CreateInstance(System.IServiceProvider,System.Type,System.Type[],System.Object[])
-
ILLink
IL2070
member
M:System.ComponentModel.MemberDescriptor.FindMethod(System.Type,System.String,System.Type[],System.Type,System.Boolean)
-
- ILLink
- IL2070
- member
- M:System.ComponentModel.PropertyDescriptor.CreateInstance(System.Type)
-
-
- ILLink
- IL2070
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(System.IServiceProvider,System.Type,System.Type[],System.Object[])
-
-
- ILLink
- IL2070
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(System.Type,System.Type)
-
-
- ILLink
- IL2072
- member
- M:System.ComponentModel.LicenseManager.ValidateInternalRecursive(System.ComponentModel.LicenseContext,System.Type,System.Object,System.Boolean,System.ComponentModel.License@,System.String@)
-
ILLink
IL2072
member
M:System.ComponentModel.MaskedTextProvider.Clone
-
- ILLink
- IL2072
- member
- M:System.ComponentModel.TypeDescriptor.ComNativeDescriptorProxy.#ctor
-
ILLink
IL2075
@@ -193,18 +49,6 @@
member
M:System.ComponentModel.ReflectPropertyDescriptor.FillAttributes(System.Collections.IList)
-
- ILLink
- IL2075
- member
- M:System.ComponentModel.ReflectPropertyDescriptor.get_SetMethodValue
-
-
- ILLink
- IL2075
- member
- M:System.ComponentModel.ReflectTypeDescriptionProvider.GetIntrinsicTypeEditor(System.Collections.Hashtable,System.Type)
-
ILLink
IL2080
@@ -217,12 +61,6 @@
member
M:System.ComponentModel.ReflectPropertyDescriptor.FillAttributes(System.Collections.IList)
-
- ILLink
- IL2080
- member
- M:System.ComponentModel.ReflectPropertyDescriptor.get_SetMethodValue
-
ILLink
IL2026
@@ -253,12 +91,6 @@
member
M:System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System#ComponentModel#ICustomTypeDescriptor#GetDefaultProperty
-
- ILLink
- IL2026
- member
- M:System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System#ComponentModel#ICustomTypeDescriptor#GetEditor(System.Type)
-
ILLink
IL2062
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/CustomTypeDescriptor.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/CustomTypeDescriptor.cs
index fd6e5f7167774b..163d8b59624954 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/CustomTypeDescriptor.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/CustomTypeDescriptor.cs
@@ -95,6 +95,7 @@ public virtual TypeConverter GetConverter()
/// The GetEditor method returns an editor of the given type that is
/// to be associated with the class this type descriptor is representing.
///
+ [RequiresUnreferencedCode(TypeDescriptor.EditorRequiresUnreferencedCode)]
public virtual object GetEditor(Type editorBaseType) => _parent?.GetEditor(editorBaseType);
///
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DelegatingTypeDescriptionProvider.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DelegatingTypeDescriptionProvider.cs
index 5e05f31d18b22d..b82e5924ffa594 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DelegatingTypeDescriptionProvider.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DelegatingTypeDescriptionProvider.cs
@@ -32,7 +32,11 @@ internal DelegatingTypeDescriptionProvider(Type type)
/// data type. If the method is not interested in providing a substitute
/// instance, it should call base.
///
- public override object CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, object[] args)
+ public override object CreateInstance(
+ IServiceProvider provider,
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
+ Type[] argTypes,
+ object[] args)
{
return Provider.CreateInstance(provider, objectType, argTypes, args);
}
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/ITypeResolutionService.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/ITypeResolutionService.cs
index db2b1ce1470919..b02ea35f3bb510 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/ITypeResolutionService.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/ITypeResolutionService.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
namespace System.ComponentModel.Design
@@ -23,17 +24,20 @@ public interface ITypeResolutionService
///
/// Loads a type with the given name.
///
- Type GetType(string name);
+ [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
+ Type GetType([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string name);
///
/// Loads a type with the given name.
///
- Type GetType(string name, bool throwOnError);
+ [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
+ Type GetType([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string name, bool throwOnError);
///
/// Loads a type with the given name.
///
- Type GetType(string name, bool throwOnError, bool ignoreCase);
+ [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
+ Type GetType([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string name, bool throwOnError, bool ignoreCase);
///
/// References the given assembly name. Once an assembly has
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/PropertyTabAttribute.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/PropertyTabAttribute.cs
index 19038d77f08d53..73eca9e8a4fd28 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/PropertyTabAttribute.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/PropertyTabAttribute.cs
@@ -38,7 +38,10 @@ public PropertyTabAttribute(Type tabClass) : this(tabClass, PropertyTabScope.Com
/// Basic constructor that creates a property tab attribute that will create a tab
/// of the specified type.
///
- public PropertyTabAttribute(string tabClassName) : this(tabClassName, PropertyTabScope.Component)
+ public PropertyTabAttribute(
+ // Using PublicParameterlessConstructor to preserve the type. See https://github.com/mono/linker/issues/1878
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string tabClassName)
+ : this(tabClassName, PropertyTabScope.Component)
{
}
@@ -60,7 +63,10 @@ public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
/// Basic constructor that creates a property tab attribute that will create a tab
/// of the specified type.
///
- public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
+ public PropertyTabAttribute(
+ // Using PublicParameterlessConstructor to preserve the type. See https://github.com/mono/linker/issues/1878
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string tabClassName,
+ PropertyTabScope tabScope)
{
_tabClassNames = new string[] { tabClassName };
if (tabScope < PropertyTabScope.Document)
@@ -79,43 +85,52 @@ public Type[] TabClasses
{
if (_tabClasses == null && _tabClassNames != null)
{
- _tabClasses = new Type[_tabClassNames.Length];
- for (int i = 0; i < _tabClassNames.Length; i++)
- {
- int commaIndex = _tabClassNames[i].IndexOf(',');
- string className = null;
- string assemblyName = null;
+ InitializeTabClasses();
+ }
+ return _tabClasses;
+ }
+ }
- if (commaIndex != -1)
- {
- className = _tabClassNames[i].AsSpan(0, commaIndex).Trim().ToString();
- assemblyName = _tabClassNames[i].AsSpan(commaIndex + 1).Trim().ToString();
- }
- else
- {
- className = _tabClassNames[i];
- }
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "The APIs that specify _tabClassNames are either marked with DynamicallyAccessedMembers or RequiresUnreferencedCode.")]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2057:TypeGetType",
+ Justification = "The APIs that specify _tabClassNames are either marked with DynamicallyAccessedMembers or RequiresUnreferencedCode.")]
+ private void InitializeTabClasses()
+ {
+ _tabClasses = new Type[_tabClassNames.Length];
+ for (int i = 0; i < _tabClassNames.Length; i++)
+ {
+ int commaIndex = _tabClassNames[i].IndexOf(',');
+ string className = null;
+ string assemblyName = null;
- _tabClasses[i] = Type.GetType(className, false);
+ if (commaIndex != -1)
+ {
+ className = _tabClassNames[i].AsSpan(0, commaIndex).Trim().ToString();
+ assemblyName = _tabClassNames[i].AsSpan(commaIndex + 1).Trim().ToString();
+ }
+ else
+ {
+ className = _tabClassNames[i];
+ }
+
+ _tabClasses[i] = Type.GetType(className, false);
- if (_tabClasses[i] == null)
+ if (_tabClasses[i] == null)
+ {
+ if (assemblyName != null)
+ {
+ Assembly a = Assembly.Load(assemblyName);
+ if (a != null)
{
- if (assemblyName != null)
- {
- Assembly a = Assembly.Load(assemblyName);
- if (a != null)
- {
- _tabClasses[i] = a.GetType(className, true);
- }
- }
- else
- {
- throw new TypeLoadException(SR.Format(SR.PropertyTabAttributeTypeLoadException, className));
- }
+ _tabClasses[i] = a.GetType(className, true);
}
}
+ else
+ {
+ throw new TypeLoadException(SR.Format(SR.PropertyTabAttributeTypeLoadException, className));
+ }
}
- return _tabClasses;
}
}
@@ -128,9 +143,9 @@ public Type[] TabClasses
public override bool Equals(object other)
{
- if (other is PropertyTabAttribute)
+ if (other is PropertyTabAttribute propertyTabAttribute)
{
- return Equals((PropertyTabAttribute)other);
+ return Equals(propertyTabAttribute);
}
return false;
}
@@ -158,7 +173,6 @@ public bool Equals(PropertyTabAttribute other)
return true;
}
-
///
/// Returns the hashcode for this object.
///
@@ -167,6 +181,7 @@ public bool Equals(PropertyTabAttribute other)
///
/// Utiliity function to set the types of tab classes this PropertyTabAttribute specifies.
///
+ [RequiresUnreferencedCode("The Types referenced by tabClassNames may be trimmed.")]
protected void InitializeArrays(string[] tabClassNames, PropertyTabScope[] tabScopes)
{
InitializeArrays(tabClassNames, null, tabScopes);
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ICustomTypeDescriptor.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ICustomTypeDescriptor.cs
index f194821f7d36fb..579f2ca9100dae 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ICustomTypeDescriptor.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ICustomTypeDescriptor.cs
@@ -44,6 +44,7 @@ public interface ICustomTypeDescriptor
///
/// Gets an editor of the specified type for this object.
///
+ [RequiresUnreferencedCode(TypeDescriptor.EditorRequiresUnreferencedCode)]
object GetEditor(Type editorBaseType);
///
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/InstallerTypeAttribute.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/InstallerTypeAttribute.cs
index d88952b15c829f..2ad8d8941c9524 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/InstallerTypeAttribute.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/InstallerTypeAttribute.cs
@@ -11,12 +11,13 @@ namespace System.ComponentModel
[AttributeUsage(AttributeTargets.Class)]
public class InstallerTypeAttribute : Attribute
{
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
private readonly string _typeName;
///
/// Initializes a new instance of the System.Windows.Forms.ComponentModel.InstallerTypeAttribute class.
///
- public InstallerTypeAttribute(Type installerType)
+ public InstallerTypeAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type installerType)
{
if (installerType == null)
{
@@ -26,7 +27,7 @@ public InstallerTypeAttribute(Type installerType)
_typeName = installerType.AssemblyQualifiedName;
}
- public InstallerTypeAttribute(string typeName)
+ public InstallerTypeAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] string typeName)
{
_typeName = typeName;
}
@@ -34,6 +35,7 @@ public InstallerTypeAttribute(string typeName)
///
/// Gets the type of installer associated with this attribute.
///
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
public virtual Type InstallerType => Type.GetType(_typeName);
public override bool Equals(object obj)
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
index c340d12247eeef..d3acf78aff558c 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
@@ -4,6 +4,7 @@
using System.Collections;
using System.ComponentModel.Design;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.Versioning;
using System.Threading;
@@ -118,7 +119,9 @@ private static void CacheProvider(Type type, LicenseProvider provider)
/// as the context in which the licensed instance can be used.
///
[UnsupportedOSPlatform("browser")]
- public static object CreateWithContext(Type type, LicenseContext creationContext)
+ public static object CreateWithContext(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type,
+ LicenseContext creationContext)
{
return CreateWithContext(type, creationContext, Array.Empty