<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>95863758cd16c345d0b8fca067d5db5d6901e498</Sha>
</Dependency>
- <Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.6.21378.1">
+ <Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.6.21402.2">
<Uri>https://github.com/mono/linker</Uri>
- <Sha>0cb9250a903cfc90cbac602ed79c0cbc588d8d3f</Sha>
+ <Sha>ae18468b8712503aee67911228dd921601bd423a</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21373.1">
<Uri>https://github.com/dotnet/xharness</Uri>
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
- <MicrosoftNETILLinkTasksVersion>6.0.100-preview.6.21378.1</MicrosoftNETILLinkTasksVersion>
+ <MicrosoftNETILLinkTasksVersion>6.0.100-preview.6.21402.2</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkAnalyzerPackageVersion>$(MicrosoftNETILLinkTasksVersion)</MicrosoftNETILLinkAnalyzerPackageVersion>
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-rc.1.21369.1</MicrosoftNETCoreRuntimeICUTransportVersion>
<!-- Suppress analyzer and linker warnings as these are tests -->
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
+ <!-- Can be removed when SDK update picks up https://github.com/dotnet/sdk/pull/18655. -->
+ <NoWarn>$(NoWarn);IL2111</NoWarn>
</PropertyGroup>
<ItemGroup>
<PublishTrimmed>true</PublishTrimmed>
<!-- Suppress linker warnings as these are tests -->
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
+ <!-- Can be removed when SDK update picks up https://github.com/dotnet/sdk/pull/18655. -->
+ <NoWarn>$(NoWarn);IL2111</NoWarn>
<!-- https://github.com/dotnet/sdk/issues/18581 tracks needing to set 2 properties to disable warnings. -->
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
private readonly LicenseInteropProxy _licenseProxy = new LicenseInteropProxy();
private readonly Guid _classId;
- [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces | DynamicallyAccessedMemberTypes.PublicConstructors)]
private readonly Type _classType;
- public LicenseClassFactory(Guid clsid, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)] Type classType)
+ public LicenseClassFactory(Guid clsid, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces | DynamicallyAccessedMemberTypes.PublicConstructors)] Type classType)
{
_classId = clsid;
_classType = classType;
private object? _licContext;
private Type? _targetRcwType;
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2111:ReflectionToDynamicallyAccessedMembers",
+ Justification = "The type parameter to LicenseManager.CreateWithContext method has PublicConstructors annotation. We only invoke this method" +
+ "from AllocateAndValidateLicense which annotates the value passed in with the same annotation.")]
public LicenseInteropProxy()
{
Type licManager = Type.GetType("System.ComponentModel.LicenseManager, System.ComponentModel.TypeConverter", throwOnError: true)!;
// If we are being entered because of a call to ICF::CreateInstanceLic(),
// "isDesignTime" will be "false" and "key" will point to a non-null
// license key.
- public object AllocateAndValidateLicense(Type type, string? key, bool isDesignTime)
+ public object AllocateAndValidateLicense([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, string? key, bool isDesignTime)
{
object?[] parameters;
object? licContext;
<UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification:=IDOBinder.SuppressionJustification)>
+ <UnconditionalSuppressMessage("ReflectionAnalysis", "IL2111:ReflectionToDynamicallyAccessedMembers",
+ Justification:=IDOBinder.SuppressionJustification)>
Public Overrides Function FallbackConvert(
ByVal target As DynamicMetaObject,
ByVal errorSuggestion As DynamicMetaObject) As DynamicMetaObject
namespace System.Data.Common
{
- // This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
- // https://github.com/mono/linker/issues/2136 tracks making it possible to add more granular suppressions at the member level, and with a different warning code.
- [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
- Justification = "The use of GetType preserves members with RequiresUnreferencedCode, but the GetType callsites either "
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2113:ReflectionToRequiresUnreferencedCode",
+ Justification = "The use of GetType preserves ICustomTypeDescriptor members with RequiresUnreferencedCode, but the GetType callsites either "
+ "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")]
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
public class DbConnectionStringBuilder : IDictionary, ICustomTypeDescriptor
return attributes;
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "The use of GetType preserves this member with RequiresUnreferencedCode, but the GetType callsites either "
+ + "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")]
[RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered.")]
private PropertyDescriptorCollection GetProperties()
{
return propertyDescriptors;
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "The use of GetType preserves this member with RequiresUnreferencedCode, but the GetType callsites either "
+ + "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")]
[RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered.")]
protected virtual void GetProperties(Hashtable propertyDescriptors)
{
}
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "The use of GetType preserves this member with RequiresUnreferencedCode, but the GetType callsites either "
+ + "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")]
[RequiresUnreferencedCode("The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
{
[XmlSchemaProvider(nameof(GetDataSetSchema))]
[XmlRoot(nameof(DataSet))]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- // This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
- // https://github.com/mono/linker/issues/2136 tracks making it possible to add more granular suppressions at the member level, and with a different warning code.
- [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
- Justification = "CreateInstanceOfThisType's use of GetType uses only the parameterless constructor, but the annotations preserve all non-public constructors causing a warning for the serialization constructors. Those constructors won't be used here.")]
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)] // needed by Clone() to preserve derived ctors
public class DataSet : MarshalByValueComponent, IListSource, IXmlSerializable, ISupportInitializeNotification, ISerializable
{
// Deserialize all the tables schema and data of the dataset from binary/xml stream.
[RequiresUnreferencedCode(RequiresUnreferencedCodeMessage)]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "CreateInstanceOfThisType's use of GetType uses only the parameterless constructor, but the annotations preserve all non-public constructors causing a warning for the serialization constructors. Those constructors won't be used here.")]
protected DataSet(SerializationInfo info, StreamingContext context) : this(info, context, true)
{
}
[RequiresUnreferencedCode(RequiresUnreferencedCodeMessage)]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "CreateInstanceOfThisType's use of GetType uses only the parameterless constructor, but the annotations preserve all non-public constructors causing a warning for the serialization constructors. Those constructors won't be used here.")]
protected DataSet(SerializationInfo info, StreamingContext context, bool ConstructSchema) : this()
{
SerializationFormat remotingFormat = SerializationFormat.Xml;
[XmlSchemaProvider(nameof(GetDataTableSchema))]
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- // This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
- // https://github.com/mono/linker/issues/2136 tracks making it possible to add more granular suppressions at the member level, and with a different warning code.
- [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
- Justification = "CreateInstance's use of GetType uses only the parameterless constructor. Warnings are about serialization related constructors.")]
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
public class DataTable : MarshalByValueComponent, IListSource, ISupportInitializeNotification, ISerializable, IXmlSerializable
{
}
// Deserialize the table from binary/xml stream.
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "CreateInstance's use of GetType uses only the parameterless constructor. Warnings are about serialization related constructors.")]
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
protected DataTable(SerializationInfo info, StreamingContext context) : this()
{
DataColumn ColumnSize = new DataColumn(SchemaTableColumn.ColumnSize, typeof(int));
DataColumn NumericPrecision = new DataColumn(SchemaTableColumn.NumericPrecision, typeof(short));
DataColumn NumericScale = new DataColumn(SchemaTableColumn.NumericScale, typeof(short));
- DataColumn DataType = new DataColumn(SchemaTableColumn.DataType, typeof(Type));
+ DataColumn DataType = GetSystemTypeDataColumn();
+
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2111:ReflectionToDynamicallyAccessedMembers",
+ Justification = "The problem is Type.TypeInitializer which requires constructors on the Type instance." +
+ "In this case the TypeInitializer property is not accessed dynamically.")]
+ static DataColumn GetSystemTypeDataColumn() =>
+ new DataColumn(SchemaTableColumn.DataType, typeof(Type));
+
DataColumn ProviderType = new DataColumn(SchemaTableColumn.ProviderType, typeof(int));
DataColumn IsLong = new DataColumn(SchemaTableColumn.IsLong, typeof(bool));
DataColumn AllowDBNull = new DataColumn(SchemaTableColumn.AllowDBNull, typeof(bool));
/// This is the generic base class for TypedDataSet
/// </summary>
[Serializable]
- // This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
- // https://github.com/mono/linker/issues/2136 tracks making it possible to add more granular suppressions at the member level, and with a different warning code.
- [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
- Justification = "DataTable.CreateInstance's use of GetType uses only the parameterless constructor. Warnings are about serialization related constructors.")]
public abstract class TypedTableBase<T> : DataTable, IEnumerable<T> where T : DataRow
{
/// </summary>
/// <param name="info">SerializationInfo containing data to construct the object.</param>
/// <param name="context">The streaming context for the object being deserialized.</param>
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "DataTable.CreateInstance's use of GetType uses only the parameterless constructor, not this serialization related constructor.")]
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
protected TypedTableBase(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context) { }
<property name="Scope">member</property>
<property name="Target">M:System.Data.OleDb.OleDbDataReader.GetFieldType(System.Int32)</property>
</attribute>
- </assembly>
+ <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
+ <argument>ILLink</argument>
+ <argument>IL2111</argument>
+ <property name="Scope">member</property>
+ <property name="Target">M:System.Data.OleDb.OleDbDataReader.BuildSchemaTable(MetaData[])</property>
+ </attribute> </assembly>
</linker>
\ No newline at end of file
/// See the DiagnosticSourceEventSourceBridgeTest.cs for more explicit examples of using this bridge.
/// </summary>
[EventSource(Name = "Microsoft-Diagnostics-DiagnosticSource")]
- // This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
- // https://github.com/mono/linker/issues/2136 tracks making it possible to add more granular suppressions at the member level, and with a different warning code.
- [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
- Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves all members, so " +
- "those that are marked with RequiresUnreferencedCode will warn. " +
- "This method will not access any of these members and is safe to call.")]
+ // These suppressions can go away with https://github.com/mono/linker/issues/2175
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2113:ReflectionToRequiresUnreferencedCode",
+ Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves methods on Delegate and MulticastDelegate " +
+ "because the nested type OverrideEventProvider's base type EventProvider defines a delegate. " +
+ "This includes Delegate and MulticastDelegate methods which require unreferenced code, but " +
+ "EnsureDescriptorsInitialized does not access these members and is safe to call.")]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2115:ReflectionToDynamicallyAccessedMembers",
+ Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves methods on Delegate and MulticastDelegate " +
+ "because the nested type OverrideEventProvider's base type EventProvider defines a delegate. " +
+ "This includes Delegate and MulticastDelegate methods which have dynamically accessed members requirements, but " +
+ "EnsureDescriptorsInitialized does not access these members and is safe to call.")]
internal sealed class DiagnosticSourceEventSource : EventSource
{
public static DiagnosticSourceEventSource Log = new DiagnosticSourceEventSource();
}
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(DiagnosticSource.WriteRequiresUnreferencedCode)]
public List<KeyValuePair<string, string?>> Morph(object? args)
{
// Given a type generate all the implicit transforms for type (that is for every field
// generate the spec that fetches it).
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(DiagnosticSource.WriteRequiresUnreferencedCode)]
private static TransformSpec? MakeImplicitTransforms(Type type)
{
/// if the spec is OUTSTR=EVENT_VALUE.PROP1.PROP2.PROP3 and the ultimate value of PROP3 is
/// 10 then the return key value pair is KeyValuePair("OUTSTR","10")
/// </summary>
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(DiagnosticSource.WriteRequiresUnreferencedCode)]
public KeyValuePair<string, string?> Morph(object? obj)
{
/// Given an object fetch the property that this PropertySpec represents.
/// obj may be null when IsStatic is true, otherwise it must be non-null.
/// </summary>
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(DiagnosticSource.WriteRequiresUnreferencedCode)]
public object? Fetch(object? obj)
{
/// <summary>
/// Create a property fetcher for a propertyName
/// </summary>
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(DiagnosticSource.WriteRequiresUnreferencedCode)]
public static PropertyFetch FetcherForProperty(Type? type, string propertyName)
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.Linq;
using System;
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "MulticastDelegate has a ctor with RequiresUnreferencedCode, but the generated derived type doesn't reference this ctor, so this is trim compatible.")]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2111:ReflectionToDynamicallyAccessedMembers",
+ Justification = "MulticastDelegate and Delegate have multiple methods with DynamicallyAccessedMembers annotations. But the generated code" +
+ "in this case will not call any of them (it only defines a .ctor and Invoke method both of which are runtime implemented.")]
internal static TypeBuilder DefineDelegateType(string name)
{
return Assembly.DefineType(
// The EnsureDescriptorsInitialized() method might need to access EventSource and its derived type
// members and the trimmer ensures that these members are preserved.
[DynamicallyAccessedMembers(ManifestMemberTypes)]
- // This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
- // https://github.com/mono/linker/issues/2136 tracks making it possible to add more granular suppressions at the member level, and with a different warning code.
- [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
- Justification = "EnsureDescriptorsInitialized's use of GetType preserves all members, so " +
- "those that are marked with RequiresUnreferencedCode will warn. " +
- "This method will not access any of these members and is safe to call.")]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2113:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves methods on Delegate and MulticastDelegate " +
+ "because the nested type OverrideEventProvider's base type EventProvider defines a delegate. " +
+ "This includes Delegate and MulticastDelegate methods which require unreferenced code, but " +
+ "EnsureDescriptorsInitialized does not access these members and is safe to call.")]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2115:ReflectionToDynamicallyAccessedMembers",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves methods on Delegate and MulticastDelegate " +
+ "because the nested type OverrideEventProvider's base type EventProvider defines a delegate. " +
+ "This includes Delegate and MulticastDelegate methods which have dynamically accessed members requirements, but " +
+ "EnsureDescriptorsInitialized does not access these members and is safe to call.")]
#endif
public partial class EventSource : IDisposable
{
/// <param name="assemblyPathToIncludeInManifest">The manifest XML fragment contains the string name of the DLL name in
/// which it is embedded. This parameter specifies what name will be used</param>
/// <returns>The XML data string</returns>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2114:ReflectionToDynamicallyAccessedMembers",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "has dynamically accessed members requirements, but EnsureDescriptorsInitialized does not "+
+ "access this member and is safe to call.")]
+#endif
public static string? GenerateManifest(
#if !ES_BUILD_STANDALONE
[DynamicallyAccessedMembers(ManifestMemberTypes)]
/// <param name="flags">The flags to customize manifest generation. If flags has bit OnlyIfNeededForRegistration specified
/// this returns null when the eventSourceType does not require explicit registration</param>
/// <returns>The XML data string or null</returns>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2114:ReflectionToDynamicallyAccessedMembers",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "has dynamically accessed members requirements, but EnsureDescriptorsInitialized does not "+
+ "access this member and is safe to call.")]
+#endif
public static string? GenerateManifest(
#if !ES_BUILD_STANDALONE
[DynamicallyAccessedMembers(ManifestMemberTypes)]
/// </code>
/// </remarks>
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
#endif
[CLSCompliant(false)]
/// </code>
/// </remarks>
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
#endif
[CLSCompliant(false)]
/// check so that the varargs call is not made when the EventSource is not active.
/// </summary>
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
#endif
protected unsafe void WriteEvent(int eventId, params object?[] args)
/// check so that the varargs call is not made when the EventSource is not active.
/// </summary>
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
#endif
protected unsafe void WriteEventWithRelatedActivityId(int eventId, Guid relatedActivityId, params object?[] args)
}
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
#endif
private unsafe void WriteEventVarargs(int eventId, Guid* childActivityID, object?[] args)
}
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
#endif
private unsafe object?[] SerializeEventArgs(int eventId, object?[] args)
public TraceLoggingEventTypes TraceLoggingEventTypes
{
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
#endif
get
// Helper to deal with the fact that the type we are reflecting over might be loaded in the ReflectionOnly context.
// When that is the case, we have the build the custom assemblies on a member by hand.
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2114:ReflectionToDynamicallyAccessedMembers",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "has dynamically accessed members requirements, but EnsureDescriptorsInitialized does not "+
+ "access this member and is safe to call.")]
+#endif
internal static Attribute? GetCustomAttributeHelper(
MemberInfo member,
#if !ES_BUILD_STANDALONE
// return the UTF8 bytes. It also sets up the code:EventData structures needed to dispatch events
// at run time. 'source' is the event source to place the descriptors. If it is null,
// then the descriptors are not created, and just the manifest is generated.
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2114:ReflectionToDynamicallyAccessedMembers",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "has dynamically accessed members requirements, but its use of this method satisfies " +
+ "these requirements because it passes in the result of GetType with the same annotations.")]
+#endif
private static byte[]? CreateManifestAndDescriptors(
#if !ES_BUILD_STANDALONE
[DynamicallyAccessedMembers(ManifestMemberTypes)]
/// create the fields of the event.
/// </param>
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
public unsafe void Write<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(
#else
/// create the fields of the event.
/// </param>
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
public unsafe void Write<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(
#else
/// create the fields of the event.
/// </param>
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
public unsafe void Write<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(
#else
/// create the fields of the event.
/// </param>
#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:ReflectionToRequiresUnreferencedCode",
+ Justification = "EnsureDescriptorsInitialized's use of GetType preserves this method which " +
+ "requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
[RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
public unsafe void Write<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(
#else
{
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "This warns because the call to Base has the type annotated with DynamicallyAccessedMembers so it warns" +
- "when looking into the methods of NullPrimitiveDataContract. Because this just represents null, we suppress.")]
+ "when looking into the methods of NullPrimitiveDataContract which are annotated with RequiresUnreferencedCodeAttribute. " +
+ "Because this just represents null, we suppress.")]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2111:ReflectionToDynamicallyAccessedMembers",
+ Justification = "This warns because the call to Base has the type annotated with DynamicallyAccessedMembers so it warns" +
+ "when looking into the methods of NullPrimitiveDataContract which are annotated with DynamicallyAccessedMembersAttribute. " +
+ "Because this just represents null, we suppress.")]
public NullPrimitiveDataContract() : base(typeof(NullPrimitiveDataContract), DictionaryGlobals.EmptyString, DictionaryGlobals.EmptyString)
{
return _underlyingType;
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2110:ReflectionToDynamicallyAccessedMembers",
+ Justification = "For instance members with MethodImplOptions.InternalCall, the linker preserves all fields of the declaring type. " +
+ "The _tb field has DynamicallyAccessedMembersAttribute requirements, but the field access is safe because " +
+ "Reflection.Emit is not subject to trimming.")]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void setup_enum_type(Type t);
null);
}
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2110:ReflectionToDynamicallyAccessedMembers",
+ Justification = "For instance member internal calls, the linker preserves all fields of the declaring type. " +
+ "The parent and created fields have DynamicallyAccessedMembersAttribute requirements, but creating the runtime class is safe " +
+ "because the annotations fully preserve the parent type, and the type created via Reflection.Emit is not subject to trimming.")]
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern TypeInfo create_runtime_class();