[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "DiagnosticSource.Write is marked with RequiresUnreferencedCode.")]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2119",
+ Justification = "DAM on EventSource references this compiler-generated local function which calls a " +
+ "method that requires unreferenced code. EventSource will not access this local function.")]
void OnEventWritten(KeyValuePair<string, object?> evnt)
{
// The filter given to the DiagnosticSource may not work if users don't is 'IsEnabled' as expected.
#if !ES_BUILD_STANDALONE
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "The call to TraceLoggingEventTypes with the below parameter values are trim safe")]
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2119",
+ Justification = "DAM on EventSource references this compiler-generated local function which calls a " +
+ "constructor that requires unreferenced code. EventSource will not access this local function.")]
#endif
static TraceLoggingEventTypes GetTrimSafeTraceLoggingEventTypes() =>
new TraceLoggingEventTypes(EventName, EventTags.None, new Type[] { typeof(string) });
// The .NET Foundation licenses this file to you under the MIT license.
using System.Threading;
+using System.Diagnostics.CodeAnalysis;
namespace System.Diagnostics.Tracing
{
base.WriteEvent((int)EventId.AppContextSwitch, switchName, value);
}
+ [UnconditionalSuppressMessage ("ReflectionAnalysis", "IL2119",
+ Justification = "DAM on EventSource references the compiler-generated lambda methods some of which call PInvokes " +
+ "which are considered potentially dangerous. Event source will not use these lambdas.")]
protected override void OnEventCommand(EventCommandEventArgs command)
{
if (command.Command == EventCommand.Enable)
internal sealed class DateTimeDataContract : PrimitiveDataContract
{
+ [UnconditionalSuppressMessage ("ReflectionAnalysis", "IL2118",
+ Justification = "DAM on the first parameter of the PrimitiveDataContract constructor references methods of DateTime, " +
+ "which has a compiler-generated local function LowGranularityNonCachedFallback that calls PInvokes " +
+ "which are considered potentially dangerous. Data contract serialization will not access this local function.")]
public DateTimeDataContract() : base(typeof(DateTime), DictionaryGlobals.DateTimeLocalName, DictionaryGlobals.SchemaNamespace)
{
}
"token"
};
+ [UnconditionalSuppressMessage ("ReflectionAnalysis", "IL2118",
+ Justification = "DAM on AddPrimitive references methods of DateTime, which has a compiler-generated local function " +
+ "LowGranularityNonCachedFallback that calls PInvokes which are considered potentially dangerous. " +
+ "XML serialization will not access this local function.")]
static TypeScope()
{
AddPrimitive(typeof(string), "string", "String", TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.CanBeTextValue | TypeFlags.Reference | TypeFlags.HasDefaultConstructor);
return false;
}
+ [UnconditionalSuppressMessage ("ReflectionAnalysis", "IL2118",
+ Justification = "DAM on AddPrimitive references methods of DateTime, which has a compiler-generated local function " +
+ "LowGranularityNonCachedFallback that calls PInvokes which are considered potentially dangerous. " +
+ "XML serialization will not access this local function.")]
private static void AddSoapEncodedTypes(string ns)
{
AddSoapEncodedPrimitive(typeof(string), "normalizedString", ns, "String", new XmlQualifiedName("normalizedString", XmlSchema.Namespace), TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.Reference | TypeFlags.HasDefaultConstructor);