Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom EventSources in shared library seem to have unused code #54859

Closed
LakshanF opened this issue Jun 28, 2021 · 14 comments · Fixed by #73868
Closed

Custom EventSources in shared library seem to have unused code #54859

LakshanF opened this issue Jun 28, 2021 · 14 comments · Fixed by #73868
Assignees
Labels
area-System.Net linkable-framework Issues associated with delivering a linker friendly framework
Milestone

Comments

@LakshanF
Copy link
Member

LakshanF commented Jun 28, 2021

The EventSource type has an attribute that the trimmer will interpret to keep all members of it as well as all its descendants. A pending trimmer checkin honors this for non-public custom EventSources in library trim mode that affects the shared framework library build.

There is a sizeable difference (around 70K or so of IL) of code that is kept after this trimmer change. A quick analysis of the difference shows that there are members in custom event sources that were not noticed earlier. For example, NetEventSource is used in multiple libraries where the additional members might not be needed (we shipped without this extra code prior to the trimmer change).

Consider removing members from these custom EventSource in the source code itself if they are not needed in the libraries or add tests if they are needed.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jun 28, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@stephentoub
Copy link
Member

@LakshanF, FYI, the NetEventSource ones you're referring to are implemented as some shared methods in a partial class, and then each networking library includes that partial file and adds its own partial file that primarily just adds a unique guid / name. So it's not as simple as just removing unused code from that shared file, as different libs may use different subsets of the methods, and were relying on the linker to get rid of unused ones.

@LakshanF
Copy link
Member Author

@stephentoub, unfortunately the pending PR will make the trimmer not get rid of unused code in a special mode of trimming named 'library mode' that is used in building the libraries in the runtime. This is to handle cases like this library test that logs using the NetEventSource.

Below are some relevant details

  • Prior to .NET6, The trimmer had a special handling for EventSource to allow cases like the test case above which only kept nested types
  • In .NET6, trimmer added a feature to generalize the EventSource pattern by allowing the dynamic attribute to be applied to types such that all its derived types will also get the dynamic attribute applied
    - However, this will only happen if a type is used and there is a object.GetType() reflection pattern on that type
  • We still couldn't get rid of the pre .NET6 special handling of EventSource due to the library mode trimming getting rid of unused code in the non-publicly visible NetEventSource since there is no object.GetType() in the library
  • The pending PR adds an optimization mode that when disabled will allow the dynamic attribute to be applied to derived types only when the type is referenced (does not need object.GetType() reflection pattern)
    - I assume this optimization mode will be disabled in the library build for all libraries that will cause the size problem above
  • The EventSource dynamic attribute scope is really large (All, which will preserve everything) since that is the only way to get NestedTypes to be preserved. We have a pending issue to scope this down but still will likely impact this scenario to some degree since I assume we will keep methods as well in EventSource.

@jkotas
Copy link
Member

jkotas commented Jun 30, 2021

So should we rather keep the special handling of EventSource until this is resolved? Are there reasons why we have to get rid of the special handling for .NET 6?

Note that this is not just about the extra IL. It has also impact at runtime when tracing is enable that is increasingly more common. The event source will have to build manifests for the unused events now.

@marek-safar
Copy link
Contributor

Are there reasons why we have to get rid of the special handling for .NET 6?

There are two reasons

  • It always marks the nested types even if the event source support is explicitly disabled
  • We use different logic to mark potentially same code twice

Note that this is not just about the extra IL. It has also impact at runtime when tracing is enable that is increasingly more common. The event source will have to build manifests for the unused events now.

I suggested libraries trim mode implementation in the linker which would address that instead of marking everything.

@tommcdon
Copy link
Member

tommcdon commented Jul 8, 2021

@LakshanF @vitek-karas do you plan on fixing this issue in .NET 6?

@LakshanF
Copy link
Member Author

LakshanF commented Jul 8, 2021

We are talking to the network team to see if they can fix this (as in use only the source code they need instead of relying on the trimmer to remove unused code). Its possible that this might not be possible to do in 6.0 in which case, we can punt this issue

@noahfalk noahfalk removed the untriaged New issue has not been triaged by the area owner label Jul 14, 2021
@LakshanF LakshanF added this to the 7.0.0 milestone Jul 14, 2021
@LakshanF LakshanF assigned karelz and unassigned LakshanF Jul 14, 2021
@LakshanF
Copy link
Member Author

I’m no EventSource tracing expert but I think the fix should be around not to use the same source code for all the NetEventSource (each net library have their own copy), remove methods that have the [NonEvent] attribute that are not used in the specific net library, and not to have nested types if generating the manifest is not needed.

The above and library tests and consultation with tracing & trimmer teams should help with this

@ghost
Copy link

ghost commented Jul 14, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

The EventSource type has an attribute that the trimmer will interpret to keep all members of it as well as all its descendants. A pending trimmer checkin honors this for non-public custom EventSources in library trim mode that affects the shared framework library build.

There is a sizeable difference (around 70K or so of IL) of code that is kept after this trimmer change. A quick analysis of the difference shows that there are members in custom event sources that were not noticed earlier. For example, NetEventSource is used in multiple libraries where the additional members might not be needed (we shipped without this extra code prior to the trimmer change).

Consider removing members from these custom EventSource in the source code itself if they are not needed in the libraries or add tests if they are needed.

Author: LakshanF
Assignees: -
Labels:

area-System.Net

Milestone: 7.0.0

@karelz karelz added the linkable-framework Issues associated with delivering a linker friendly framework label Jul 14, 2021
@ghost
Copy link

ghost commented Jul 14, 2021

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr
See info in area-owners.md if you want to be subscribed.

Issue Details

The EventSource type has an attribute that the trimmer will interpret to keep all members of it as well as all its descendants. A pending trimmer checkin honors this for non-public custom EventSources in library trim mode that affects the shared framework library build.

There is a sizeable difference (around 70K or so of IL) of code that is kept after this trimmer change. A quick analysis of the difference shows that there are members in custom event sources that were not noticed earlier. For example, NetEventSource is used in multiple libraries where the additional members might not be needed (we shipped without this extra code prior to the trimmer change).

Consider removing members from these custom EventSource in the source code itself if they are not needed in the libraries or add tests if they are needed.

Author: LakshanF
Assignees: -
Labels:

area-System.Net, linkable-framework

Milestone: 7.0.0

@LakshanF
Copy link
Member Author

Below are the specific file size differences I can see when trimming shared FX assemblies in library mode (for example, for the first file, passing this line to the trimmer (with additional details): -a "runtime\artifacts\obj\System.Net.Primitives\net6.0-windows-Debug\PreTrim\System.Net.NetworkInformation.dll" library

System.Net.NetworkInformation.dll, Difference: 9,216, Percent: 11.84% Pre:87,040, Post:77,824
System.Net.Primitives.dll, Difference: 8,704, Percent: 9.44% Pre:100,864, Post:92,160
System.Net.Quic.dll, Difference: 8,192, Percent: 6.90% Pre:126,976, Post:118,784
System.Net.NameResolution.dll, Difference: 7,680, Percent: 17.86% Pre:50,688, Post:43,008
System.Net.Sockets.dll, Difference: 6,656, Percent: 3.15% Pre:218,112, Post:211,456
System.Net.Requests.dll, Difference: 6,144, Percent: 3.92% Pre:162,816, Post:156,672
System.Net.Http.dll, Difference: 5,632, Percent: 0.72% Pre:791,040, Post:785,408
System.Net.Security.dll, Difference: 5,120, Percent: 1.86% Pre:280,064, Post:274,944
System.Net.Mail.dll, Difference: 4,608, Percent: 1.94% Pre:241,664, Post:237,056
System.Net.HttpListener.dll, Difference: 3,584, Percent: 1.15% Pre:316,416, Post:312,832

@LakshanF
Copy link
Member Author

LakshanF commented Jul 20, 2021

Additional details of unused source code of System.Net.NetEventSource:

Unused Code in System_Net_Http for System.Net.NetEventSource:
Field:System.Int32 System.Net.NetEventSource::UriBaseAddressId
Field:System.Int32 System.Net.NetEventSource::ContentNullId
Field:System.Int32 System.Net.NetEventSource::HeadersInvalidValueId
Field:System.Int32 System.Net.NetEventSource::HandlerMessageId
Field:System.Int32 System.Net.NetEventSource::AuthenticationInfoId
Field:System.Int32 System.Net.NetEventSource::AuthenticationErrorId
Field:System.Int32 System.Net.NetEventSource::HandlerErrorId
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.Int32,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.IntPtr,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::SecurityContextInputBuffer(System.String,System.Int32,System.Int32,Interop/SECURITY_STATUS)


Unused Code in System_Net_HttpListener for System.Net.NetEventSource:
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::SecurityContextInputBuffer(System.String,System.Int32,System.Int32,Interop/SECURITY_STATUS)


Unused Code in System_Net_Mail for System.Net.NetEventSource:
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.Int32,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.IntPtr,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::SecurityContextInputBuffer(System.String,System.Int32,System.Int32,Interop/SECURITY_STATUS)


Unused Code in System_Net_NameResolution for System.Net.NetEventSource:
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.Int32,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.IntPtr,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)


Unused Code in System_Net_NetworkInformation for System.Net.NetEventSource:
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::Info(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Info(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Info(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::Error(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.Int32,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.IntPtr,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.String System.Net.NetEventSource::Format(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)


Unused Code in System_Net_Primitives for System.Net.NetEventSource:
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::Error(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Error(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::ErrorMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.Int32,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.IntPtr,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)


Unused Code in System_Net_Quic for System.Net.NetEventSource:
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::Error(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.Int32,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.IntPtr,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)


Unused Code in System_Net_Requests for System.Net.NetEventSource:
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.Int32,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.IntPtr,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Byte[])
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)


Unused Code in System_Net_Security for System.Net.NetEventSource:
Field:System.Int32 System.Net.NetEventSource::SecureChannelCtorId
Field:System.Int32 System.Net.NetEventSource::LocatingPrivateKeyId
Field:System.Int32 System.Net.NetEventSource::CertIsType2Id
Field:System.Int32 System.Net.NetEventSource::FoundCertInStoreId
Field:System.Int32 System.Net.NetEventSource::NotFoundCertInStoreId
Field:System.Int32 System.Net.NetEventSource::RemoteCertificateId
Field:System.Int32 System.Net.NetEventSource::CertificateFromDelegateId
Field:System.Int32 System.Net.NetEventSource::NoDelegateNoClientCertId
Field:System.Int32 System.Net.NetEventSource::NoDelegateButClientCertId
Field:System.Int32 System.Net.NetEventSource::AttemptingRestartUsingCertId
Field:System.Int32 System.Net.NetEventSource::NoIssuersTryAllCertsId
Field:System.Int32 System.Net.NetEventSource::LookForMatchingCertsId
Field:System.Int32 System.Net.NetEventSource::SelectedCertId
Field:System.Int32 System.Net.NetEventSource::CertsAfterFilteringId
Field:System.Int32 System.Net.NetEventSource::FindingMatchingCertsId
Field:System.Int32 System.Net.NetEventSource::UsingCachedCredentialId
Field:System.Int32 System.Net.NetEventSource::SspiSelectedCipherSuitId
Field:System.Int32 System.Net.NetEventSource::RemoteCertificateErrorId
Field:System.Int32 System.Net.NetEventSource::RemoteVertificateValidId
Field:System.Int32 System.Net.NetEventSource::RemoteCertificateSuccesId
Field:System.Int32 System.Net.NetEventSource::RemoteCertificateInvalidId
Field:System.Int32 System.Net.NetEventSource::SslStreamCtorId
Field:System.Int32 System.Net.NetEventSource::SentFrameId
Field:System.Int32 System.Net.NetEventSource::ReceivedFrameId
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::ReceivedFrame(System.Net.Security.SslStream,System.ReadOnlySpan`1<System.Byte>)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.Int32,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.IntPtr,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::SecurityContextInputBuffer(System.String,System.Int32,System.Int32,Interop/SECURITY_STATUS)


Unused Code in System_Net_Sockets for System.Net.NetEventSource:
Field:System.Int32 System.Net.NetEventSource::AcceptedId
Field:System.Int32 System.Net.NetEventSource::ConnectedId
Field:System.Int32 System.Net.NetEventSource::ConnectedAsyncDnsId
Field:System.Int32 System.Net.NetEventSource::NotLoggedFileId
Field:System.String System.Net.NetEventSource::EventSourceSuppressMessage
Field:System.String System.Net.NetEventSource::MissingMember
Field:System.String System.Net.NetEventSource::NullInstance
Field:System.String System.Net.NetEventSource::StaticMethodObject
Field:System.String System.Net.NetEventSource::NoParameters
Field:System.Int32 System.Net.NetEventSource::MaxDumpSize
Field:System.Int32 System.Net.NetEventSource::AssociateEventId
Field:System.Int32 System.Net.NetEventSource::InfoEventId
Field:System.Int32 System.Net.NetEventSource::ErrorEventId
Field:System.Int32 System.Net.NetEventSource::DumpArrayEventId
Field:System.Int32 System.Net.NetEventSource::EnumerateSecurityPackagesId
Field:System.Int32 System.Net.NetEventSource::SspiPackageNotFoundId
Field:System.Int32 System.Net.NetEventSource::AcquireDefaultCredentialId
Field:System.Int32 System.Net.NetEventSource::AcquireCredentialsHandleId
Field:System.Int32 System.Net.NetEventSource::InitializeSecurityContextId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBufferId
Field:System.Int32 System.Net.NetEventSource::SecurityContextInputBuffersId
Field:System.Int32 System.Net.NetEventSource::AcceptSecuritContextId
Field:System.Int32 System.Net.NetEventSource::OperationReturnedSomethingId
Field:System.Int32 System.Net.NetEventSource::NextAvailableEventId
Method:System.Void System.Net.NetEventSource::NotLoggedFile(System.String,System.Net.Sockets.Socket,System.Net.Sockets.SocketAsyncOperation)
Method:System.Void System.Net.NetEventSource::NotLoggedFile(System.String,System.Int32,System.Net.Sockets.SocketAsyncOperation)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Memory`1<System.Byte>,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.FormattableString,System.String)
Method:System.Void System.Net.NetEventSource::Verbose(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::VerboseMessage(System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DumpBuffer(System.Object,System.Byte[],System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.Object,System.Object,System.Object,System.String)
Method:System.Void System.Net.NetEventSource::Associate(System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.Object)
Method:System.Void System.Net.NetEventSource::DebugValidateArg(System.FormattableString)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.String)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.String,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
Method:System.Void System.Net.NetEventSource::WriteEvent(System.Int32,System.String,System.String,System.Int32,System.Int32,System.Int32)

@MihaZupan
Copy link
Member

@LakshanF is my understanding correct that the linker is currently unable to trim a substantial amount of code from NetEventSource. It would therefore be beneficial for the trimmed assembly size if we refactored this code such that the unused methods would not be shared between multiple assemblies?

If that's the case, could you please share how we can test the impact of such changes locally (linker commands, etc)?
I don't see this described in workflow docs in this repo - is there a better source I should be looking at? Thanks

@jkotas
Copy link
Member

jkotas commented Jul 19, 2022

The linker runs automatically at the end of libraries build. You can do release build before and after the change and check the sizes of the affected assemblies.

@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Aug 12, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 15, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants