-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add always trimmed attributes list for browser config #39000
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
Conversation
Example of size reduction on SPC with the most minimalistic Hello World sample. | System.Private.CoreLib | Size (kB) | Delta | |-|-|-| | Original | 1358 kB | - | | Trimmed | 1271 kB | - 87 kB |
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
src/mono/netcore/System.Private.CoreLib/System.Private.CoreLib.csproj
Outdated
Show resolved
Hide resolved
src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.wasm.xml
Outdated
Show resolved
Hide resolved
src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.wasm.xml
Outdated
Show resolved
Hide resolved
src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.wasm.xml
Outdated
Show resolved
Hide resolved
| </type> | ||
| <type fullname="System.Runtime.CompilerServices.CompilerGeneratedAttribute"> | ||
| <attribute internal="RemoveAttributeInstances" /> | ||
| </type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CompilerGenerated is checked by StackTrace.ToString, so this will affect Exception.StackTrace/ToString(), for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's ugly. Looking at the code it looks like CompilerGeneratedAttribute usage there is optimization like check.
We could remove the check or if it's really needed we could remove this attribute under Debug.IsEnabled condition only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this one and add it with the rest of the Debug-only attributes under the Debugger.IsSupported feature switch?
Examples of the Debug-only attributes that can be removed are:
- DebuggerTypeProxyAttribute
- DebuggerDisplayAttribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code it looks like CompilerGeneratedAttribute usage there is optimization like check.
I think it's more there in case the types in question were implemented by someone manually; it's trying to only remove the relevant frames when they're on compiler generated types for async and iterators. It may be over protective, but I'm hesitant to remove it for the purposes of this PR.
Should we remove this one and add it with the rest of the Debug-only attributes under the Debugger.IsSupported feature switch?
That sounds reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to be conditional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to make sure I understand: in cases where debugger is disabled the StackTrace would now include the compiler-generated frames?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct: the code looking for the attribute wouldn't find it, and so wouldn't skip the frames.
src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.wasm.xml
Show resolved
Hide resolved
src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.wasm.xml
Show resolved
Hide resolved
src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.wasm.xml
Outdated
Show resolved
Hide resolved
Add ExcludeFromCodeCoverageAttribute.
Add note about Obsolete. Only use assembly fullname="*" for compiler generated attributes.
| </type> | ||
| <type fullname="System.Runtime.CompilerServices.CompilerGeneratedAttribute" feature="System.Diagnostics.Debugger.IsSupported" featurevalue="false"> | ||
| <!-- | ||
| The attribute is used during pretty stack trace printing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StackTraceHidden is used for the same purpose. You can add it with the same condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, there is a bunch of others which should be added as conditional (e.g. whole ETW). I'd prefer to add them in follow up PRs
|
Setting |
|
Removing the |
eerhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ready to be merged. Any other feedback?
|
Hello @eerhardt! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Example of size reduction on SPC with the most minimalistic Hello
World console sample.
Trimming the CarChecker app with this change results in
@eerhardt @vitek-karas