Remove some unnecessary EventSource suppressions#125258
Conversation
Due to the DynamicallyAccessedMembersAttribute on the EventSource type, all members that have DAM/RUC on them produce warnings that need to be suppressed. In NAOT it also causes extra metadata to be preserved. By moving these members into a nested type, it excludes them from reflection visibility and means we don't have to have suppressions.
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-diagnostics-tracing |
|
This diff looks messier than it is -- I just moved the two functions inside a nested class and removed the UnconditionalSuppressMessage attributes. |
There was a problem hiding this comment.
Pull request overview
Refactors EventSource manifest/attribute reflection helpers into a private nested type to avoid trim-analysis suppressions triggered by EventSource’s [DynamicallyAccessedMembers] annotation (and reduce preserved metadata for NativeAOT).
Changes:
- Route
GetGuid,GetName, manifest generation, and descriptor initialization through a newEventSourceHelpersnested type. - Move
CreateManifestAndDescriptorsandGetCustomAttributeHelperinto the nested helper to remove prior suppressions on those members.
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Show resolved
Hide resolved
noahfalk
left a comment
There was a problem hiding this comment.
Looks good to me. The big diff appears to be caused by the method order in the new nested type not matching exactly the original method order.
|
/ba-g issue is #125245 |
Due to the DynamicallyAccessedMembersAttribute on the EventSource type, all members that have DAM/RUC on them produce warnings that need to be suppressed. In NAOT it also causes extra metadata to be preserved.
By moving these members into a nested type, it excludes them from reflection visibility and means we don't have to have suppressions.