Skip to content

Commit 07ea61f

Browse files
LakshanFeerhardt
andauthored
Suppresses the trimmer warning on TypeAnalysis ctor (#48823)
* eh fix * test change that inadvertently got checked in earlier * Suppresses the trimmer warning on TypeAnalysis ctor * Incorporating FB * Update src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs Co-authored-by: Eric Erhardt <[email protected]> * Update src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs Co-authored-by: Eric Erhardt <[email protected]> * Update src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs Co-authored-by: Eric Erhardt <[email protected]> * Fix DynamicDependency as per PR feedback * an earlier change got reverted * fixed proj file netcore app condition check * fixed NETCORE_ENGINEERING_TELEMETRY build failures * fixeing another NETCORE_ENGINEERING_TELEMETRY build failures * Adding RequiresUnreferencedCode to TypeAnalysis ctor instead of suppressing the warning to get FB, not fully fixed * PR FB and suppressing warnings for safe calls * propagated the warning all the way up * CI build break fix for one file * excluding NativeRTEventSrc from being build in a project * Missed couple of supppressions on NativeRTEventSrc * build break fixes Co-authored-by: Eric Erhardt <[email protected]>
1 parent ecc354a commit 07ea61f

File tree

34 files changed

+471
-20
lines changed

34 files changed

+471
-20
lines changed

src/libraries/Common/src/System/Net/Logging/NetEventSource.Common.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Collections;
1111
using System.Diagnostics;
1212
using System.Diagnostics.Tracing;
13+
using System.Diagnostics.CodeAnalysis;
1314
using System.Runtime.CompilerServices;
1415
using System.Runtime.InteropServices;
1516
#if NET46
@@ -43,6 +44,10 @@ namespace System.Net
4344
#endif
4445
internal sealed partial class NetEventSource : EventSource
4546
{
47+
#if !ES_BUILD_STANDALONE
48+
private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
49+
#endif
50+
4651
/// <summary>The single event source instance to use for all logging.</summary>
4752
public static readonly NetEventSource Log = new NetEventSource();
4853

@@ -373,6 +378,10 @@ private static string Format(FormattableString s)
373378

374379
#region Custom WriteEvent overloads
375380

381+
#if !ES_BUILD_STANDALONE
382+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
383+
Justification = EventSourceSuppressMessage)]
384+
#endif
376385
[NonEvent]
377386
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3, string? arg4)
378387
{
@@ -417,6 +426,10 @@ private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string?
417426
}
418427
}
419428

429+
#if !ES_BUILD_STANDALONE
430+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
431+
Justification = EventSourceSuppressMessage)]
432+
#endif
420433
[NonEvent]
421434
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, byte[]? arg3)
422435
{
@@ -460,6 +473,10 @@ private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, byte[]?
460473
}
461474
}
462475

476+
#if !ES_BUILD_STANDALONE
477+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
478+
Justification = EventSourceSuppressMessage)]
479+
#endif
463480
[NonEvent]
464481
private unsafe void WriteEvent(int eventId, string? arg1, int arg2, int arg3, int arg4)
465482
{
@@ -498,6 +515,10 @@ private unsafe void WriteEvent(int eventId, string? arg1, int arg2, int arg3, in
498515
}
499516
}
500517

518+
#if !ES_BUILD_STANDALONE
519+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
520+
Justification = EventSourceSuppressMessage)]
521+
#endif
501522
[NonEvent]
502523
private unsafe void WriteEvent(int eventId, string? arg1, int arg2, string? arg3)
503524
{
@@ -533,6 +554,10 @@ private unsafe void WriteEvent(int eventId, string? arg1, int arg2, string? arg3
533554
}
534555
}
535556

557+
#if !ES_BUILD_STANDALONE
558+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
559+
Justification = EventSourceSuppressMessage)]
560+
#endif
536561
[NonEvent]
537562
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, int arg3)
538563
{
@@ -568,6 +593,10 @@ private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, int arg3
568593
}
569594
}
570595

596+
#if !ES_BUILD_STANDALONE
597+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
598+
Justification = EventSourceSuppressMessage)]
599+
#endif
571600
[NonEvent]
572601
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3, int arg4)
573602
{
@@ -610,6 +639,10 @@ private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string?
610639
}
611640
}
612641

642+
#if !ES_BUILD_STANDALONE
643+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
644+
Justification = EventSourceSuppressMessage)]
645+
#endif
613646
[NonEvent]
614647
private unsafe void WriteEvent(int eventId, string arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8)
615648
{
@@ -668,6 +701,10 @@ private unsafe void WriteEvent(int eventId, string arg1, int arg2, int arg3, int
668701
}
669702
}
670703

704+
#if !ES_BUILD_STANDALONE
705+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
706+
Justification = EventSourceSuppressMessage)]
707+
#endif
671708
[NonEvent]
672709
private unsafe void WriteEvent(int eventId, string arg1, string arg2, int arg3, int arg4, int arg5)
673710
{

src/libraries/Common/src/System/Net/Security/NetEventSource.Security.Windows.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
45
using System.Diagnostics.Tracing;
56
using System.Net.Security;
67

78
namespace System.Net
89
{
910
internal sealed partial class NetEventSource
1011
{
12+
#if !ES_BUILD_STANDALONE
13+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
14+
Justification = "parameter intent is an enum and is trimmer safe")]
15+
#endif
1116
[Event(AcquireDefaultCredentialId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
1217
public void AcquireDefaultCredential(string packageName, Interop.SspiCli.CredentialUse intent)
1318
{
@@ -59,6 +64,10 @@ public void AcceptSecurityContext(SafeFreeCredentials? credential, SafeDeleteCon
5964
private void AcceptSecurityContext(string credential, string context, Interop.SspiCli.ContextFlags inFlags) =>
6065
WriteEvent(AcceptSecuritContextId, credential, context, (int)inFlags);
6166

67+
#if !ES_BUILD_STANDALONE
68+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
69+
Justification = "parameter errorCode is an enum and is trimmer safe")]
70+
#endif
6271
[Event(OperationReturnedSomethingId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
6372
public void OperationReturnedSomething(string operation, Interop.SECURITY_STATUS errorCode)
6473
{
@@ -68,6 +77,10 @@ public void OperationReturnedSomething(string operation, Interop.SECURITY_STATUS
6877
}
6978
}
7079

80+
#if !ES_BUILD_STANDALONE
81+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
82+
Justification = "parameter errorCode is an enum and is trimmer safe")]
83+
#endif
7184
[Event(SecurityContextInputBufferId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
7285
public void SecurityContextInputBuffer(string context, int inputBufferSize, int outputBufferSize, Interop.SECURITY_STATUS errorCode)
7386
{

src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<ItemGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) != '.NETCoreApp'">
3232
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicDependencyAttribute.cs" />
3333
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
34+
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
3435
</ItemGroup>
3536
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.1'">
3637
<Compile Include="$(CommonPath)System\HexConverter.cs" Link="Common\System\HexConverter.cs" />
@@ -105,4 +106,4 @@
105106
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.1' and '$(TargetFramework)' != '$(NetCoreAppCurrent)'">
106107
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.CompilerServices.Unsafe\src\System.Runtime.CompilerServices.Unsafe.ilproj" />
107108
</ItemGroup>
108-
</Project>
109+
</Project>

src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ public void Message(string? Message)
223223
/// <summary>
224224
/// Events from DiagnosticSource can be forwarded to EventSource using this event.
225225
/// </summary>
226+
#if !ES_BUILD_STANDALONE
227+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
228+
Justification = "Arguments parameter is trimmer safe")]
229+
#endif
226230
[Event(2, Keywords = Keywords.Events)]
227231
private void Event(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>>? Arguments)
228232
{
@@ -243,6 +247,10 @@ private void EventJson(string SourceName, string EventName, string ArgmentsJson)
243247
/// <summary>
244248
/// Used to mark the beginning of an activity
245249
/// </summary>
250+
#if !ES_BUILD_STANDALONE
251+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
252+
Justification = "Arguments parameter is trimmer safe")]
253+
#endif
246254
[Event(4, Keywords = Keywords.Events)]
247255
private void Activity1Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
248256
{
@@ -252,6 +260,10 @@ private void Activity1Start(string SourceName, string EventName, IEnumerable<Key
252260
/// <summary>
253261
/// Used to mark the end of an activity
254262
/// </summary>
263+
#if !ES_BUILD_STANDALONE
264+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
265+
Justification = "Arguments parameter is trimmer safe")]
266+
#endif
255267
[Event(5, Keywords = Keywords.Events)]
256268
private void Activity1Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
257269
{
@@ -261,6 +273,10 @@ private void Activity1Stop(string SourceName, string EventName, IEnumerable<KeyV
261273
/// <summary>
262274
/// Used to mark the beginning of an activity
263275
/// </summary>
276+
#if !ES_BUILD_STANDALONE
277+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
278+
Justification = "Arguments parameter is trimmer safe")]
279+
#endif
264280
[Event(6, Keywords = Keywords.Events)]
265281
private void Activity2Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
266282
{
@@ -270,6 +286,10 @@ private void Activity2Start(string SourceName, string EventName, IEnumerable<Key
270286
/// <summary>
271287
/// Used to mark the end of an activity that can be recursive.
272288
/// </summary>
289+
#if !ES_BUILD_STANDALONE
290+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
291+
Justification = "Arguments parameter is trimmer safe")]
292+
#endif
273293
[Event(7, Keywords = Keywords.Events)]
274294
private void Activity2Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
275295
{
@@ -279,6 +299,10 @@ private void Activity2Stop(string SourceName, string EventName, IEnumerable<KeyV
279299
/// <summary>
280300
/// Used to mark the beginning of an activity
281301
/// </summary>
302+
#if !ES_BUILD_STANDALONE
303+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
304+
Justification = "Arguments parameter is trimmer safe")]
305+
#endif
282306
[Event(8, Keywords = Keywords.Events, ActivityOptions = EventActivityOptions.Recursive)]
283307
private void RecursiveActivity1Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
284308
{
@@ -288,6 +312,10 @@ private void RecursiveActivity1Start(string SourceName, string EventName, IEnume
288312
/// <summary>
289313
/// Used to mark the end of an activity that can be recursive.
290314
/// </summary>
315+
#if !ES_BUILD_STANDALONE
316+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
317+
Justification = "Arguments parameter is trimmer safe")]
318+
#endif
291319
[Event(9, Keywords = Keywords.Events, ActivityOptions = EventActivityOptions.Recursive)]
292320
private void RecursiveActivity1Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string?>> Arguments)
293321
{
@@ -311,6 +339,10 @@ private void NewDiagnosticListener(string SourceName)
311339
/// <param name="SourceName">The ActivitySource name</param>
312340
/// <param name="ActivityName">The Activity name</param>
313341
/// <param name="Arguments">Name and value pairs of the Activity properties</param>
342+
#if !ES_BUILD_STANDALONE
343+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
344+
Justification = "Arguments parameter is trimmer safe")]
345+
#endif
314346
#if NO_EVENTSOURCE_COMPLEX_TYPE_SUPPORT
315347
[Event(11, Keywords = Keywords.Events)]
316348
#else
@@ -325,6 +357,10 @@ private void ActivityStart(string SourceName, string ActivityName, IEnumerable<K
325357
/// <param name="SourceName">The ActivitySource name</param>
326358
/// <param name="ActivityName">The Activity name</param>
327359
/// <param name="Arguments">Name and value pairs of the Activity properties</param>
360+
#if !ES_BUILD_STANDALONE
361+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
362+
Justification = "Arguments parameter is trimmer safe")]
363+
#endif
328364
#if NO_EVENTSOURCE_COMPLEX_TYPE_SUPPORT
329365
[Event(12, Keywords = Keywords.Events)]
330366
#else

src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,29 @@ protected void WriteEvent(int eventId, long arg1, byte[]? arg2) { }
190190
protected void WriteEvent(int eventId, long arg1, long arg2) { }
191191
protected void WriteEvent(int eventId, long arg1, long arg2, long arg3) { }
192192
protected void WriteEvent(int eventId, long arg1, string? arg2) { }
193+
[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")]
193194
protected void WriteEvent(int eventId, params object?[] args) { }
194195
protected void WriteEvent(int eventId, string? arg1) { }
195196
protected void WriteEvent(int eventId, string? arg1, int arg2) { }
196197
protected void WriteEvent(int eventId, string? arg1, int arg2, int arg3) { }
197198
protected void WriteEvent(int eventId, string? arg1, long arg2) { }
198199
protected void WriteEvent(int eventId, string? arg1, string? arg2) { }
199200
protected void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3) { }
201+
[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")]
200202
[System.CLSCompliantAttribute(false)]
201203
protected unsafe void WriteEventCore(int eventId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) { }
204+
[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")]
202205
protected void WriteEventWithRelatedActivityId(int eventId, System.Guid relatedActivityId, params object?[] args) { }
206+
[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")]
203207
[System.CLSCompliantAttribute(false)]
204208
protected unsafe void WriteEventWithRelatedActivityIdCore(int eventId, System.Guid* relatedActivityId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) { }
209+
[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")]
205210
public void Write<T>(string? eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data) { }
211+
[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")]
206212
public void Write<T>(string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref System.Guid activityId, ref System.Guid relatedActivityId, ref T data) { }
213+
[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")]
207214
public void Write<T>(string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref T data) { }
215+
[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")]
208216
public void Write<T>(string? eventName, T data) { }
209217
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
210218
protected internal partial struct EventData

src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<!-- Ensure Assemblies are first resolved via targeting pack when targeting net461 -->
1212
<AssemblySearchPaths Condition="'$(TargetFramework)' == 'net461'">$(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.6.1\1.0.1\lib\net461\;$(AssemblySearchPaths)</AssemblySearchPaths>
1313
</PropertyGroup>
14+
<ItemGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) != '.NETCoreApp'">
15+
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
16+
</ItemGroup>
1417
<ItemGroup Condition="'$(TargetsWindows)' == 'true'" >
1518
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs"
1619
Link="Common\Interop\Windows\Interop.Libraries.cs" />

src/libraries/System.Net.Http/src/System/Net/Http/HttpTelemetry.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ public void Http20ConnectionClosed()
158158
ConnectionClosed(versionMajor: 2, versionMinor: 0);
159159
}
160160

161+
#if !ES_BUILD_STANDALONE
162+
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
163+
Justification = "Parameters to this method are primitive and are trimmer safe")]
164+
#endif
161165
[NonEvent]
162166
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, int arg3, string? arg4, byte arg5, byte arg6, HttpVersionPolicy arg7)
163167
{
@@ -215,6 +219,10 @@ private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, int arg3
215219
}
216220
}
217221

222+
#if !ES_BUILD_STANDALONE
223+
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
224+
Justification = "Parameters to this method are primitive and are trimmer safe")]
225+
#endif
218226
[NonEvent]
219227
private unsafe void WriteEvent(int eventId, double arg1, byte arg2, byte arg3)
220228
{
@@ -243,6 +251,10 @@ private unsafe void WriteEvent(int eventId, double arg1, byte arg2, byte arg3)
243251
}
244252
}
245253

254+
#if !ES_BUILD_STANDALONE
255+
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
256+
Justification = "Parameters to this method are primitive and are trimmer safe")]
257+
#endif
246258
[NonEvent]
247259
private unsafe void WriteEvent(int eventId, byte arg1, byte arg2)
248260
{

src/libraries/System.Net.Http/src/System/Net/Http/NetEventSource.Http.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Diagnostics.Tracing;
67

78
namespace System.Net
@@ -73,6 +74,10 @@ public static void AuthenticationError(Uri? uri, string message)
7374
public void AuthenticationError(string? uri, string message) =>
7475
WriteEvent(AuthenticationErrorId, uri, message);
7576

77+
#if !ES_BUILD_STANDALONE
78+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
79+
Justification = "Parameters to this method are primitive and are trimmer safe")]
80+
#endif
7681
[NonEvent]
7782
private unsafe void WriteEvent(int eventId, int arg1, int arg2, int arg3, string? arg4, string? arg5)
7883
{

0 commit comments

Comments
 (0)