-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
Labels
area-System.Diagnosticsfeature-requestsize-reductionIssues impacting final app size primary for size sensitive workloadsIssues impacting final app size primary for size sensitive workloads
Milestone
Description
The source line info support for System.Diagnostics.StackTrace/StackFrame comes with a noticeable cost for workloads which are size sensitive and don't contain PDB information anyway.
With change #32023, we added a PreserveDependency attribute here:
runtime/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs
Lines 87 to 93 in 768c6fc
| // This is necessary because linker can't add new assemblies to the closure when recognizing Type.GetType | |
| // so the code below is actually recognized by linker, but fails to resolve the type since the System.Diagnostics.StackTrace | |
| // is not always part of the closure linker works on. | |
| // PreserveDependencyAttribute on the other hand can pull in additional assemblies. | |
| [PreserveDependency("GetSourceLineInfo", "System.Diagnostics.StackTraceSymbols", "System.Diagnostics.StackTrace")] | |
| [PreserveDependency(".ctor()", "System.Diagnostics.StackTraceSymbols", "System.Diagnostics.StackTrace")] | |
| internal void InitializeSourceInfo(int iSkip, bool fNeedFileInfo, Exception? exception) |
As noted in the PR, the change added ~200K to the "Console Hello World" app, bringing in the following assemblies, which were not needed before:
We should consider adding a feature switch (dotnet/designs#99) or similar functionality to allow app developers to opt-out of this behavior.
charlesroddie
Metadata
Metadata
Assignees
Labels
area-System.Diagnosticsfeature-requestsize-reductionIssues impacting final app size primary for size sensitive workloadsIssues impacting final app size primary for size sensitive workloads
