// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
-using System.Runtime.InteropServices;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
+using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace System
/// <summary>
/// Called from within the EE and is used to handle calls on methods of event interfaces.
/// </summary>
- internal object GetEventProvider(RuntimeType t)
+ internal object GetEventProvider(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] RuntimeType t)
{
// Check to see if we already have a cached event provider for this type.
object? provider = GetData(t);
internal void FinalReleaseSelf() => Marshal.InternalFinalReleaseComObject(this);
- private object CreateEventProvider(RuntimeType t)
+ private object CreateEventProvider(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] RuntimeType t)
{
// Create the event provider for the specified type.
object EvProvider = Activator.CreateInstance(t, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, new object[] { this }, null)!;
#nullable enable
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
namespace System.Drawing
return colors;
}
- private static void FillWithProperties(Dictionary<string, Color> dictionary, Type typeWithColors)
+ private static void FillWithProperties(
+ Dictionary<string, Color> dictionary,
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type typeWithColors) // can remove NonPublicProperties once https://github.com/mono/linker/issues/1724 is fixed
{
foreach (PropertyInfo prop in typeWithColors.GetProperties(BindingFlags.Public | BindingFlags.Static))
{
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
- <argument>IL2070</argument>
- <property name="Scope">member</property>
- <property name="Target">M:System.Drawing.ColorTable.FillWithProperties(System.Collections.Generic.Dictionary{System.String,System.Drawing.Color},System.Type)</property>
- </attribute>
- <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
- <argument>ILLink</argument>
<argument>IL2072</argument>
<property name="Scope">member</property>
<property name="Target">M:System.ComponentModel.LicenseManager.ValidateInternalRecursive(System.ComponentModel.LicenseContext,System.Type,System.Object,System.Boolean,System.ComponentModel.License@,System.String@)</property>
<property name="Target">M:System.ComponentModel.BindingList`1.get_ItemTypeHasDefaultConstructor</property>
</attribute>
</assembly>
-</linker>
\ No newline at end of file
+</linker>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<linker>
- <assembly fullname="System.Drawing.Primitives, PublicKeyToken=b03f5f7f11d50a3a">
- <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
- <argument>ILLink</argument>
- <argument>IL2070</argument>
- <property name="Scope">member</property>
- <property name="Target">M:System.Drawing.ColorTable.FillWithProperties(System.Collections.Generic.Dictionary{System.String,System.Drawing.Color},System.Type)</property>
- </attribute>
- </assembly>
-</linker>
\ No newline at end of file
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=true)]
public sealed partial class ValueSerializerAttribute : System.Attribute
{
- public ValueSerializerAttribute(string valueSerializerTypeName) { }
- public ValueSerializerAttribute(System.Type valueSerializerType) { }
+ public ValueSerializerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] string valueSerializerTypeName) { }
+ public ValueSerializerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type valueSerializerType) { }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Type ValueSerializerType { get { throw null; } }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public string ValueSerializerTypeName { get { throw null; } }
}
}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<linker>
- <assembly fullname="System.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a">
- <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
- <argument>ILLink</argument>
- <argument>IL2057</argument>
- <property name="Scope">member</property>
- <property name="Target">M:System.Windows.Markup.ValueSerializerAttribute.get_ValueSerializerType</property>
- </attribute>
- <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
- <argument>ILLink</argument>
- <argument>IL2079</argument>
- <property name="Scope">member</property>
- <property name="Target">M:System.ComponentModel.TypeConverterAttribute.#ctor</property>
- </attribute>
- </assembly>
-</linker>
\ No newline at end of file
// 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.Runtime.CompilerServices;
namespace System.Windows.Markup
[TypeForwardedFrom("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
public sealed class ValueSerializerAttribute : Attribute
{
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
private Type? _valueSerializerType;
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
private readonly string? _valueSerializerTypeName;
/// <summary>
/// Constructor for the ValueSerializerAttribute
/// </summary>
/// <param name="valueSerializerType">Type of the value serializer being associated with a type or property</param>
- public ValueSerializerAttribute(Type valueSerializerType)
+ public ValueSerializerAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type valueSerializerType)
{
_valueSerializerType = valueSerializerType;
}
/// Constructor for the ValueSerializerAttribute
/// </summary>
/// <param name="valueSerializerTypeName">Fully qualified type name of the value serializer being associated with a type or property</param>
- public ValueSerializerAttribute(string valueSerializerTypeName)
+ public ValueSerializerAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] string valueSerializerTypeName)
{
_valueSerializerTypeName = valueSerializerTypeName;
}
/// <summary>
/// The type of the value serializer to create for this type or property.
/// </summary>
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
public Type ValueSerializerType
{
get
/// <summary>
/// The assembly qualified name of the value serializer type for this type or property.
/// </summary>
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
public string ValueSerializerTypeName
{
get
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
- <argument>IL2067</argument>
- <property name="Scope">member</property>
- <property name="Target">M:System.__ComObject.CreateEventProvider(System.RuntimeType)</property>
- </attribute>
- <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
- <argument>ILLink</argument>
<argument>IL2070</argument>
<property name="Scope">member</property>
<property name="Target">M:System.Diagnostics.Tracing.NullableTypeInfo.#ctor(System.Type,System.Collections.Generic.List{System.Type})</property>
// 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.Runtime.InteropServices
{
[AttributeUsage(AttributeTargets.Interface, Inherited = false)]
public sealed class ComEventInterfaceAttribute : Attribute
{
- public ComEventInterfaceAttribute(Type SourceInterface, Type EventProvider)
+ private const DynamicallyAccessedMemberTypes EventProviderAccessedMemberTypes =
+ DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors |
+ DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields;
+
+ public ComEventInterfaceAttribute(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type SourceInterface,
+ [DynamicallyAccessedMembers(EventProviderAccessedMemberTypes)] Type EventProvider)
{
this.SourceInterface = SourceInterface;
this.EventProvider = EventProvider;
}
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
public Type SourceInterface { get; }
+ [DynamicallyAccessedMembers(EventProviderAccessedMemberTypes)]
public Type EventProvider { get; }
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public partial class ComAwareEventInfo : System.Reflection.EventInfo
{
- public ComAwareEventInfo(System.Type type, string eventName) { }
+ public ComAwareEventInfo([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)] System.Type type, string eventName) { }
public override System.Reflection.EventAttributes Attributes { get { throw null; } }
public override System.Type? DeclaringType { get { throw null; } }
public override int MetadataToken { get { throw null; } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class ComEventInterfaceAttribute : System.Attribute
{
- public ComEventInterfaceAttribute(System.Type SourceInterface, System.Type EventProvider) { }
+ public ComEventInterfaceAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type SourceInterface, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] System.Type EventProvider) { }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Type EventProvider { get { throw null; } }
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Type SourceInterface { get { throw null; } }
}
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<linker>
- <assembly fullname="System.Runtime.InteropServices, PublicKeyToken=b03f5f7f11d50a3a">
- <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
- <argument>ILLink</argument>
- <argument>IL2070</argument>
- <property name="Scope">member</property>
- <property name="Target">M:System.Runtime.InteropServices.ComAwareEventInfo.#ctor(System.Type,System.String)</property>
- </attribute>
- <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
- <argument>ILLink</argument>
- <argument>IL2075</argument>
- <property name="Scope">member</property>
- <property name="Target">M:System.Runtime.InteropServices.ComAwareEventInfo.GetDataForComInvocation(System.Reflection.EventInfo,System.Guid@,System.Int32@)</property>
- </attribute>
- </assembly>
-</linker>
\ No newline at end of file
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.Versioning;
{
private readonly EventInfo _innerEventInfo;
- public ComAwareEventInfo(Type type, string eventName)
+ public ComAwareEventInfo([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents)] Type type, string eventName)
{
_innerEventInfo = type.GetEvent(eventName)!;
}