using System.Collections;
using System.Diagnostics;
using System.Diagnostics.Tracing;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if NET46
#endif
internal sealed partial class NetEventSource : EventSource
{
+#if !ES_BUILD_STANDALONE
+ private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
+#endif
+
/// <summary>The single event source instance to use for all logging.</summary>
public static readonly NetEventSource Log = new NetEventSource();
#region Custom WriteEvent overloads
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3, string? arg4)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, byte[]? arg3)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string? arg1, int arg2, int arg3, int arg4)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string? arg1, int arg2, string? arg3)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, int arg3)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3, int arg4)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string arg1, string arg2, int arg3, int arg4, int arg5)
{
// 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.Diagnostics.Tracing;
using System.Net.Security;
{
internal sealed partial class NetEventSource
{
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "parameter intent is an enum and is trimmer safe")]
+#endif
[Event(AcquireDefaultCredentialId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
public void AcquireDefaultCredential(string packageName, Interop.SspiCli.CredentialUse intent)
{
private void AcceptSecurityContext(string credential, string context, Interop.SspiCli.ContextFlags inFlags) =>
WriteEvent(AcceptSecuritContextId, credential, context, (int)inFlags);
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "parameter errorCode is an enum and is trimmer safe")]
+#endif
[Event(OperationReturnedSomethingId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
public void OperationReturnedSomething(string operation, Interop.SECURITY_STATUS errorCode)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "parameter errorCode is an enum and is trimmer safe")]
+#endif
[Event(SecurityContextInputBufferId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
public void SecurityContextInputBuffer(string context, int inputBufferSize, int outputBufferSize, Interop.SECURITY_STATUS errorCode)
{
<ItemGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) != '.NETCoreApp'">
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicDependencyAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
+ <Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.1'">
<Compile Include="$(CommonPath)System\HexConverter.cs" Link="Common\System\HexConverter.cs" />
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.1' and '$(TargetFramework)' != '$(NetCoreAppCurrent)'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.CompilerServices.Unsafe\src\System.Runtime.CompilerServices.Unsafe.ilproj" />
</ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
/// <summary>
/// Events from DiagnosticSource can be forwarded to EventSource using this event.
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
[Event(2, Keywords = Keywords.Events)]
private void Event(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>>? Arguments)
{
/// <summary>
/// Used to mark the beginning of an activity
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
[Event(4, Keywords = Keywords.Events)]
private void Activity1Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
{
/// <summary>
/// Used to mark the end of an activity
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
[Event(5, Keywords = Keywords.Events)]
private void Activity1Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
{
/// <summary>
/// Used to mark the beginning of an activity
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
[Event(6, Keywords = Keywords.Events)]
private void Activity2Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
{
/// <summary>
/// Used to mark the end of an activity that can be recursive.
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
[Event(7, Keywords = Keywords.Events)]
private void Activity2Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
{
/// <summary>
/// Used to mark the beginning of an activity
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
[Event(8, Keywords = Keywords.Events, ActivityOptions = EventActivityOptions.Recursive)]
private void RecursiveActivity1Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
{
/// <summary>
/// Used to mark the end of an activity that can be recursive.
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
[Event(9, Keywords = Keywords.Events, ActivityOptions = EventActivityOptions.Recursive)]
private void RecursiveActivity1Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
{
/// <param name="SourceName">The ActivitySource name</param>
/// <param name="ActivityName">The Activity name</param>
/// <param name="Arguments">Name and value pairs of the Activity properties</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
#if NO_EVENTSOURCE_COMPLEX_TYPE_SUPPORT
[Event(11, Keywords = Keywords.Events)]
#else
/// <param name="SourceName">The ActivitySource name</param>
/// <param name="ActivityName">The Activity name</param>
/// <param name="Arguments">Name and value pairs of the Activity properties</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Arguments parameter is trimmer safe")]
+#endif
#if NO_EVENTSOURCE_COMPLEX_TYPE_SUPPORT
[Event(12, Keywords = Keywords.Events)]
#else
protected void WriteEvent(int eventId, long arg1, long arg2) { }
protected void WriteEvent(int eventId, long arg1, long arg2, long arg3) { }
protected void WriteEvent(int eventId, long arg1, string? arg2) { }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
protected void WriteEvent(int eventId, params object?[] args) { }
protected void WriteEvent(int eventId, string? arg1) { }
protected void WriteEvent(int eventId, string? arg1, int arg2) { }
protected void WriteEvent(int eventId, string? arg1, long arg2) { }
protected void WriteEvent(int eventId, string? arg1, string? arg2) { }
protected void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3) { }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
[System.CLSCompliantAttribute(false)]
protected unsafe void WriteEventCore(int eventId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) { }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
protected void WriteEventWithRelatedActivityId(int eventId, System.Guid relatedActivityId, params object?[] args) { }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
[System.CLSCompliantAttribute(false)]
protected unsafe void WriteEventWithRelatedActivityIdCore(int eventId, System.Guid* relatedActivityId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) { }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
public void Write<T>(string? eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data) { }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
public void Write<T>(string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref System.Guid activityId, ref System.Guid relatedActivityId, ref T data) { }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
public void Write<T>(string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref T data) { }
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
public void Write<T>(string? eventName, T data) { }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
protected internal partial struct EventData
<!-- Ensure Assemblies are first resolved via targeting pack when targeting net461 -->
<AssemblySearchPaths Condition="'$(TargetFramework)' == 'net461'">$(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.6.1\1.0.1\lib\net461\;$(AssemblySearchPaths)</AssemblySearchPaths>
</PropertyGroup>
+ <ItemGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) != '.NETCoreApp'">
+ <Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
+ </ItemGroup>
<ItemGroup Condition="'$(TargetsWindows)' == 'true'" >
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs"
Link="Common\Interop\Windows\Interop.Libraries.cs" />
ConnectionClosed(versionMajor: 2, versionMinor: 0);
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, int arg3, string? arg4, byte arg5, byte arg6, HttpVersionPolicy arg7)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, double arg1, byte arg2, byte arg3)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, byte arg1, byte arg2)
{
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
namespace System.Net
public void AuthenticationError(string? uri, string message) =>
WriteEvent(AuthenticationErrorId, uri, message);
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, int arg1, int arg2, int arg3, string? arg4, string? arg5)
{
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.Runtime.InteropServices;
using System.Threading;
// WriteEvent overloads taking Span<char> are imitating string arguments
// Span arguments are expected to be null-terminated
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, Span<char> arg1)
{
// 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.Diagnostics.Tracing;
using System.Net.Security;
{
internal sealed partial class NetEventSource
{
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "parameter intent is an enum and is trimmer safe")]
+#endif
[Event(AcquireDefaultCredentialId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
public void AcquireDefaultCredential(string packageName, Interop.SspiCli.CredentialUse intent)
{
private void AcceptSecurityContext(string credential, string context, Interop.SspiCli.ContextFlags inFlags) =>
WriteEvent(AcceptSecuritContextId, credential, context, (int)inFlags);
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "parameter errorCode is an enum and is trimmer safe")]
+#endif
[Event(OperationReturnedSomethingId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
public void OperationReturnedSomething(string operation, Interop.SECURITY_STATUS errorCode)
{
using System.Diagnostics;
using System.Diagnostics.Tracing;
+using System.Diagnostics.CodeAnalysis;
using System.Security.Authentication;
using System.Threading;
using Microsoft.Extensions.Internal;
[EventSource(Name = "System.Net.Security")]
internal sealed class NetSecurityTelemetry : EventSource
{
+#if !ES_BUILD_STANDALONE
+ private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
+#endif
public static readonly NetSecurityTelemetry Log = new NetSecurityTelemetry();
private IncrementingPollingCounter? _tlsHandshakeRateCounter;
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, bool arg1, string? arg2)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, SslProtocols arg1)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, bool arg1, double arg2, string? arg3)
{
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" Version="$(MicrosoftCodeAnalysisCSharpVersion)" />
</ItemGroup>
-
+
+ <ItemGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) != '.NETCoreApp'">
+ <Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
+ </ItemGroup>
+
<ItemGroup>
<Compile Include="$(LibrariesProjectRoot)\System.Private.CoreLib\generators\EventSourceGenerator.cs" />
<Compile Include="$(LibrariesProjectRoot)\System.Private.CoreLib\generators\EventSourceGenerator.Emitter.cs" />
</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.TypeAnalysis.#ctor(System.Type,System.Diagnostics.Tracing.EventDataAttribute,System.Collections.Generic.List{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.Diagnostics.Tracing.EventSource.EnsureDescriptorsInitialized</property>
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.Tracing;
+using System.Diagnostics.CodeAnalysis;
namespace System.Buffers
{
[EventSourceAutoGenerate]
internal sealed partial class ArrayPoolEventSource : EventSource
{
+#if !ES_BUILD_STANDALONE
+ private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
+#endif
internal static readonly ArrayPoolEventSource Log = new ArrayPoolEventSource();
/// <summary>Bucket ID used when renting/returning an array that's too large for a pool.</summary>
/// of BufferAllocated events being less than or equal to those numbers (ideally significantly
/// less than).
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(1, Level = EventLevel.Verbose)]
internal unsafe void BufferRented(int bufferId, int bufferSize, int poolId, int bucketId)
{
/// of BufferAllocated events is significantly smaller than the number of BufferRented and
/// BufferReturned events.
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(2, Level = EventLevel.Informational)]
internal unsafe void BufferAllocated(int bufferId, int bufferSize, int poolId, int bucketId, BufferAllocatedReason reason)
{
/// <summary>
/// Event raised when a buffer returned to the pool is dropped.
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(6, Level = EventLevel.Informational)]
internal unsafe void BufferDropped(int bufferId, int bufferSize, int poolId, int bucketId, BufferDroppedReason reason)
{
_count++;
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "The DynamicDependency will preserve the properties of CounterPayload")]
+ [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(CounterPayload))]
+#endif
internal override void WritePayload(float intervalSec, int pollingIntervalMillisec)
{
lock (this)
#pragma warning disable 1591
// optimized for common signatures (no args)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId)
{
WriteEventCore(eventId, 0, null);
}
// optimized for common signatures (ints)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, int arg1)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, int arg1, int arg2)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, int arg1, int arg2, int arg3)
{
if (IsEnabled())
}
// optimized for common signatures (longs)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, long arg1)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, long arg1, long arg2)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, long arg1, long arg2, long arg3)
{
if (IsEnabled())
}
// optimized for common signatures (strings)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, string? arg1)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, string? arg1, string? arg2)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3)
{
if (IsEnabled())
}
// optimized for common signatures (string and ints)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, string? arg1, int arg2)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, string? arg1, int arg2, int arg3)
{
if (IsEnabled())
}
// optimized for common signatures (string and longs)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, string? arg1, long arg2)
{
if (IsEnabled())
}
// optimized for common signatures (long and string)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, long arg1, string? arg2)
{
if (IsEnabled())
}
// optimized for common signatures (int and string)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, int arg1, string? arg2)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, byte[]? arg1)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, long arg1, byte[]? arg2)
{
if (IsEnabled())
/// }
/// </code>
/// </remarks>
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+#endif
[CLSCompliant(false)]
protected unsafe void WriteEventCore(int eventId, int eventDataCount, EventSource.EventData* data)
{
/// }
/// </code>
/// </remarks>
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+#endif
[CLSCompliant(false)]
protected unsafe void WriteEventWithRelatedActivityIdCore(int eventId, Guid* relatedActivityId, int eventDataCount, EventSource.EventData* data)
{
/// method signature. Even if you use this for rare events, this call should be guarded by an <see cref="IsEnabled()"/>
/// check so that the varargs call is not made when the EventSource is not active.
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+#endif
protected unsafe void WriteEvent(int eventId, params object?[] args)
{
WriteEventVarargs(eventId, null, args);
/// particular method signature. Even if you use this for rare events, this call should be guarded by an <see cref="IsEnabled()"/>
/// check so that the varargs call is not made when the EventSource is not active.
/// </summary>
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+#endif
protected unsafe void WriteEventWithRelatedActivityId(int eventId, Guid relatedActivityId, params object?[] args)
{
WriteEventVarargs(eventId, &relatedActivityId, args);
return dispatcher;
}
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+#endif
private unsafe void WriteEventVarargs(int eventId, Guid* childActivityID, object?[] args)
{
if (IsEnabled())
}
}
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+#endif
private unsafe object?[] SerializeEventArgs(int eventId, object?[] args)
{
Debug.Assert(m_eventData != null);
Keywords = (EventKeywords)unchecked(keywords),
Level = level
};
- var tlet = new TraceLoggingEventTypes(EventName, EventTags.None, new Type[] { typeof(string) });
+
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "The call to TraceLoggingEventTypes with the below parameter values are trim safe")]
+#endif
+ static TraceLoggingEventTypes GetTrimSafeTraceLoggingEventTypes() =>
+ new TraceLoggingEventTypes(EventName, EventTags.None, new Type[] { typeof(string) });
+
+ var tlet = GetTrimSafeTraceLoggingEventTypes();
WriteMultiMergeInner(EventName, ref opt, tlet, null, null, msgString);
}
else
using System.Runtime.CompilerServices;
using Internal.Runtime.CompilerServices;
+using System.Diagnostics.CodeAnalysis;
namespace System.Diagnostics.Tracing
{
[EventSourceAutoGenerate]
internal sealed partial class FrameworkEventSource : EventSource
{
+#if !ES_BUILD_STANDALONE
+ private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
+#endif
public static readonly FrameworkEventSource Log = new FrameworkEventSource();
// Keyword definitions. These represent logical groups of events that can be turned on and off independently
private FrameworkEventSource(int _) { }
// optimized for common signatures (used by the ThreadTransferSend/Receive events)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, long arg1, int arg2, string? arg3, bool arg4, int arg5, int arg6)
{
}
// optimized for common signatures (used by the ThreadTransferSend/Receive events)
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteEvent(int eventId, long arg1, int arg2, string? arg3)
{
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.Versioning;
namespace System.Diagnostics.Tracing
public override string ToString() => $"IncrementingEventCounter '{Name}' Increment {_increment}";
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "The DynamicDependency will preserve the properties of IncrementingCounterPayload")]
+ [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(IncrementingCounterPayload))]
+#endif
internal override void WritePayload(float intervalSec, int pollingIntervalMillisec)
{
lock (this) // Lock the counter
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.Versioning;
namespace System.Diagnostics.Tracing
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "The DynamicDependency will preserve the properties of IncrementingCounterPayload")]
+ [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(IncrementingCounterPayload))]
+#endif
internal override void WritePayload(float intervalSec, int pollingIntervalMillisec)
{
UpdateMetric();
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.Versioning;
namespace System.Diagnostics.Tracing
private readonly Func<double> _metricProvider;
private double _lastVal;
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "The DynamicDependency will preserve the properties of CounterPayload")]
+ [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(CounterPayload))]
+#endif
internal override void WritePayload(float intervalSec, int pollingIntervalMillisec)
{
lock (this)
{
private static TraceLoggingEventTypes? instance;
- public static TraceLoggingEventTypes Instance => instance ?? InitInstance();
+ public static TraceLoggingEventTypes Instance
+ {
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
+ get { return instance ??= InitInstance(); }
+ }
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
private static TraceLoggingEventTypes InitInstance()
{
var info = TraceLoggingTypeInfo.GetInstance(typeof(T), null);
{
private readonly TraceLoggingTypeInfo valueInfo;
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
public NullableTypeInfo(Type type, List<Type> recursionCheck)
: base(type)
{
return type.IsGenericType && type.GetGenericTypeDefinition() == (Type?)openType;
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
public static TraceLoggingTypeInfo CreateDefaultTypeInfo(
Type dataType,
List<Type> recursionCheck)
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
private byte[] ProviderMetadata => m_providerMetadata ?? Array.Empty<byte>();
#else
private protected virtual ReadOnlySpan<byte> ProviderMetadata => m_providerMetadata;
+ private const string EventSourceRequiresUnreferenceMessage = "EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type";
+ private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
#endif
#endif
/// (Native API: EventWriteTransfer)
/// </summary>
/// <param name="eventName">The name of the event.</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
public unsafe void Write(string? eventName)
{
if (!this.IsEnabled())
/// Options for the event, such as the level, keywords, and opcode. Unset
/// options will be set to default values.
/// </param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
public unsafe void Write(string? eventName, EventSourceOptions options)
{
if (!this.IsEnabled())
/// public instance properties of data will be written recursively to
/// create the fields of the event.
/// </param>
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+ public unsafe void Write<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(
+#else
public unsafe void Write<T>(
+#endif
string? eventName,
T data)
{
/// public instance properties of data will be written recursively to
/// create the fields of the event.
/// </param>
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+ public unsafe void Write<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(
+#else
public unsafe void Write<T>(
+#endif
string? eventName,
EventSourceOptions options,
T data)
/// public instance properties of data will be written recursively to
/// create the fields of the event.
/// </param>
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+ public unsafe void Write<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(
+#else
public unsafe void Write<T>(
+#endif
string? eventName,
ref EventSourceOptions options,
ref T data)
/// public instance properties of data will be written recursively to
/// create the fields of the event.
/// </param>
+#if !ES_BUILD_STANDALONE
+ [RequiresUnreferencedCode(EventSourceRequiresUnreferenceMessage)]
+ public unsafe void Write<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(
+#else
public unsafe void Write<T>(
+#endif
string? eventName,
ref EventSourceOptions options,
ref Guid activityId,
/// <param name="types">
/// The types of the fields in the event. This value must not be null.
/// </param>
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
internal TraceLoggingEventTypes(
string name,
EventTags tags,
{
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
internal TraceLoggingEventTypes(
string name,
EventTags tags,
this.nameInfos.TryGet(new KeyValuePair<string, EventTags>(name, tags)) ??
this.nameInfos.GetOrAdd(new NameInfo(name, tags, this.typeMetadata.Length));
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
private static TraceLoggingTypeInfo[] MakeArray(System.Reflection.ParameterInfo[] paramInfos)
{
if (paramInfos == null)
return result;
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
private static TraceLoggingTypeInfo[] MakeArray(Type[] types)
{
if (types == null)
[ThreadStatic] // per-thread cache to avoid synchronization
private static Dictionary<Type, TraceLoggingTypeInfo>? threadCache;
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
public static TraceLoggingTypeInfo GetInstance(Type type, List<Type>? recursionCheck)
{
Dictionary<Type, TraceLoggingTypeInfo> cache = threadCache ??= new Dictionary<Type, TraceLoggingTypeInfo>();
using System;
#endif
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
#if ES_BUILD_STANDALONE
internal readonly EventOpcode opcode = (EventOpcode)(-1);
internal readonly EventTags tags;
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource WriteEvent will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+#endif
public TypeAnalysis(
Type dataType,
EventDataAttribute? eventAttrib,
public const EventKeywords ThreadTransferKeyword = (EventKeywords)0x80000000;
}
+#if !ES_BUILD_STANDALONE
+ private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
+#endif
// This value does not seem to be used, leaving it as zero for now. It may be useful for a scenario that may involve
// multiple instances of the runtime within the same process, but then it seems unlikely that both instances' thread
// pools would be in moderate use.
ThreadTimedOut
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[NonEvent]
private unsafe void WriteThreadEvent(int eventId, uint numExistingThreads)
{
}
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(54, Level = EventLevel.Informational, Message = Messages.WorkerThreadAdjustmentSample, Task = Tasks.ThreadPoolWorkerThreadAdjustment, Opcode = Opcodes.Sample, Version = 0, Keywords = Keywords.ThreadingKeyword)]
public unsafe void ThreadPoolWorkerThreadAdjustmentSample(
double Throughput,
WriteEventCore(54, 2, data);
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(55, Level = EventLevel.Informational, Message = Messages.WorkerThreadAdjustmentAdjustment, Task = Tasks.ThreadPoolWorkerThreadAdjustment, Opcode = Opcodes.Adjustment, Version = 0, Keywords = Keywords.ThreadingKeyword)]
public unsafe void ThreadPoolWorkerThreadAdjustmentAdjustment(
double AverageThroughput,
WriteEventCore(55, 4, data);
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(56, Level = EventLevel.Verbose, Message = Messages.WorkerThreadAdjustmentStats, Task = Tasks.ThreadPoolWorkerThreadAdjustment, Opcode = Opcodes.Stats, Version = 0, Keywords = Keywords.ThreadingKeyword)]
public unsafe void ThreadPoolWorkerThreadAdjustmentStats(
double Duration,
WriteEventCore(56, 11, data);
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(63, Level = EventLevel.Verbose, Message = Messages.IOEnqueue, Task = Tasks.ThreadPool, Opcode = Opcodes.IOEnqueue, Version = 0, Keywords = Keywords.ThreadingKeyword | Keywords.ThreadTransferKeyword)]
private unsafe void ThreadPoolIOEnqueue(
IntPtr NativeOverlapped,
}
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(64, Level = EventLevel.Verbose, Message = Messages.IO, Task = Tasks.ThreadPool, Opcode = Opcodes.IODequeue, Version = 0, Keywords = Keywords.ThreadingKeyword | Keywords.ThreadTransferKeyword)]
private unsafe void ThreadPoolIODequeue(
IntPtr NativeOverlapped,
}
}
+#if !ES_BUILD_STANDALONE
+ [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(60, Level = EventLevel.Verbose, Message = Messages.WorkingThreadCount, Task = Tasks.ThreadPoolWorkingThreadCount, Opcode = EventOpcode.Start, Version = 0, Keywords = Keywords.ThreadingKeyword)]
public unsafe void ThreadPoolWorkingThreadCount(uint Count, ushort ClrInstanceID = DefaultClrInstanceId)
{
using System.Runtime.CompilerServices;
using System.Diagnostics.Tracing;
+using System.Diagnostics.CodeAnalysis;
using Internal.Runtime.CompilerServices;
namespace System.Threading.Tasks
[EventSourceAutoGenerate]
internal sealed partial class TplEventSource : EventSource
{
+#if !ES_BUILD_STANDALONE
+ private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
+#endif
/// Used to determine if tasks should generate Activity IDs for themselves
internal bool TasksSetActivityIds; // This keyword is set
internal bool Debug;
/// <param name="CreatingTaskID">The task ID</param>
/// <param name="TaskCreationOptions">The options used to create the task.</param>
/// <param name="appDomain">The ID for the current AppDomain.</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(TASKSCHEDULED_ID, Task = Tasks.TaskScheduled, Version = 1, Opcode = EventOpcode.Send,
Level = EventLevel.Informational, Keywords = Keywords.TaskTransfer | Keywords.Tasks)]
public void TaskScheduled(
/// <param name="OriginatingTaskID">The task ID.</param>
/// <param name="TaskID">The task ID.</param>
/// <param name="IsExceptional">Whether the task completed due to an error.</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(TASKCOMPLETED_ID, Version = 1,
Level = EventLevel.Informational, Keywords = Keywords.TaskStops)]
public void TaskCompleted(
/// If known, if 'TaskID' has a 'continueWith' task, mention give its ID here.
/// 0 means unknown. This allows better visualization of the common sequential chaining case.
/// </param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(TASKWAITBEGIN_ID, Version = 3, Task = TplEventSource.Tasks.TaskWait, Opcode = EventOpcode.Send,
Level = EventLevel.Informational, Keywords = Keywords.TaskTransfer | Keywords.Tasks)]
public void TaskWaitBegin(
/// <param name="OriginatingTaskSchedulerID">The scheduler ID.</param>
/// <param name="OriginatingTaskID">The task ID.</param>
/// <param name="ContinueWithTaskId">The ID of the continuation object.</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(AWAITTASKCONTINUATIONSCHEDULED_ID, Task = Tasks.AwaitTaskContinuationScheduled, Opcode = EventOpcode.Send,
Level = EventLevel.Informational, Keywords = Keywords.TaskTransfer | Keywords.Tasks)]
public void AwaitTaskContinuationScheduled(
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(TRACEOPERATIONSTART_ID, Version = 1,
Level = EventLevel.Informational, Keywords = Keywords.AsyncCausalityOperation)]
public void TraceOperationBegin(int TaskID, string OperationName, long RelatedContext)
WriteEvent(TRACESYNCHRONOUSWORKSTART_ID, TaskID, (int)Work); // optimized overload for this exists
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(TRACESYNCHRONOUSWORKSTOP_ID, Version = 1,
Level = EventLevel.Informational, Keywords = Keywords.AsyncCausalitySynchronousWork)]
public void TraceSynchronousWorkEnd(CausalitySynchronousWork Work)
[Event(24, Keywords = Keywords.Debug)]
public void DebugFacilityMessage1(string Facility, string Message, string Value1) { WriteEvent(24, Facility, Message, Value1); }
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Guid parameter is safe with WriteEvent")]
[Event(25, Keywords = Keywords.DebugActivityId)]
public void SetActivityId(Guid NewId)
{
// Dataflow Events
//
- #region Block Creation
+#region Block Creation
/// <summary>Trace an event for when a new block is instantiated.</summary>
/// <param name="block">The dataflow block that was created.</param>
/// <param name="dataflowBlockOptions">The options with which the block was created.</param>
{
WriteEvent(DATAFLOWBLOCKCREATED_EVENTID, blockName, blockId);
}
- #endregion
+#endregion
- #region Task Launching
+#region Task Launching
/// <summary>Trace an event for a block launching a task to handle messages.</summary>
/// <param name="block">The owner block launching a task.</param>
/// <param name="task">The task being launched for processing.</param>
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "WriteEvent Parameters are trimmer safe")]
+#endif
[Event(TASKLAUNCHED_EVENTID, Level = EventLevel.Informational)]
private void TaskLaunchedForMessageHandling(int blockId, TaskLaunchedReason reason, int availableMessages, int taskId)
{
/// <summary>A task is being launched to offer outgoing messages to linked targets.</summary>
OfferingOutputMessages = 2,
}
- #endregion
+#endregion
- #region Block Completion
+#region Block Completion
/// <summary>Trace an event for a block completing.</summary>
/// <param name="block">The block that's completing.</param>
[NonEvent]
Canceled = (int)TaskStatus.Canceled
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "WriteEvent Parameters are trimmer safe")]
+#endif
[Event(BLOCKCOMPLETED_EVENTID, Level = EventLevel.Informational)]
private void DataflowBlockCompleted(int blockId, BlockCompletionReason reason, string exceptionData)
{
WriteEvent(BLOCKCOMPLETED_EVENTID, blockId, reason, exceptionData);
}
- #endregion
+#endregion
- #region Linking
+#region Linking
/// <summary>Trace an event for a block linking.</summary>
/// <param name="source">The source block linking to a target.</param>
/// <param name="target">The target block being linked from a source.</param>
{
WriteEvent(BLOCKLINKED_EVENTID, sourceId, targetId);
}
- #endregion
+#endregion
- #region Unlinking
+#region Unlinking
/// <summary>Trace an event for a block unlinking.</summary>
/// <param name="source">The source block unlinking from a target.</param>
/// <param name="target">The target block being unlinked from a source.</param>
{
WriteEvent(BLOCKUNLINKED_EVENTID, sourceId, targetId);
}
- #endregion
+#endregion
}
#endif
}
<ItemGroup>
<Content Include="XmlDocs\System.Threading.Tasks.Dataflow.xml" />
</ItemGroup>
+ <ItemGroup Condition="'$(TargetFramework)' != '$(NetCoreAppCurrent)'">
+ <Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
+ </ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETCoreApp'">
<Reference Include="System.Collections" />
<Reference Include="System.Collections.Concurrent" />
using System.Collections.Generic;
using System.Text;
using System.Security;
+using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
namespace System.Threading.Tasks
[EventSource(Name = "System.Threading.Tasks.Parallel.EventSource")]
internal sealed class ParallelEtwProvider : EventSource
{
+#if !ES_BUILD_STANDALONE
+ private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
+#endif
/// <summary>
/// Defines the singleton instance for the Task.Parallel ETW provider.
/// </summary>
/// <param name="OperationType">The kind of fork/join operation.</param>
/// <param name="InclusiveFrom">The lower bound of the loop.</param>
/// <param name="ExclusiveTo">The upper bound of the loop.</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(PARALLELLOOPBEGIN_ID, Level = EventLevel.Informational, Task = ParallelEtwProvider.Tasks.Loop, Opcode = EventOpcode.Start)]
public void ParallelLoopBegin(int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER
int ForkJoinContextID, ForkJoinOperationType OperationType, // PFX_FORKJOIN_COMMON_EVENT_HEADER
/// <param name="OriginatingTaskID">The task ID.</param>
/// <param name="ForkJoinContextID">The loop ID.</param>
/// <param name="TotalIterations">the total number of iterations processed.</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(PARALLELLOOPEND_ID, Level = EventLevel.Informational, Task = ParallelEtwProvider.Tasks.Loop, Opcode = EventOpcode.Stop)]
public void ParallelLoopEnd(int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER
int ForkJoinContextID, long TotalIterations)
/// <param name="ForkJoinContextID">The invoke ID.</param>
/// <param name="OperationType">The kind of fork/join operation.</param>
/// <param name="ActionCount">The number of actions being invoked.</param>
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = EventSourceSuppressMessage)]
+#endif
[Event(PARALLELINVOKEBEGIN_ID, Level = EventLevel.Informational, Task = ParallelEtwProvider.Tasks.Invoke, Opcode = EventOpcode.Start)]
public void ParallelInvokeBegin(int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER
int ForkJoinContextID, ForkJoinOperationType OperationType, // PFX_FORKJOIN_COMMON_EVENT_HEADER
using System.Collections.Generic;
using System.Text;
using System.Security;
+using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
namespace System.Threading
// Barrier Events
//
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
+#endif
[Event(BARRIER_PHASEFINISHED_ID, Level = EventLevel.Verbose, Version = 1)]
public void Barrier_PhaseFinished(bool currentSense, long phaseNum)
{
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
}
}
+#if !ES_BUILD_STANDALONE
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
+ Justification = "TransactionScopeResult parameter is an enum and is trimmer safe")]
+#endif
[Event(TRANSACTIONSCOPE_CREATED_EVENTID, Keywords = Keywords.TraceBase, Level = EventLevel.Informational, Task = Tasks.TransactionScope, Opcode = Opcodes.Created, Message = "Transactionscope was created: Transaction ID is {0}, TransactionScope Result is {1}")]
private void TransactionScopeCreated(string transactionID, TransactionScopeResult transactionScopeResult)
{