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

Trim RefSafetyRulesAttribute when trimming aggressively #88717

Merged
merged 1 commit into from Jul 13, 2023

Conversation

MichalStrehovsky
Copy link
Member

This is another attribute that Roslyn uses for its own purposes only.

Cc @dotnet/illink-contrib (btw what's the difference between this and @dotnet/illink?)

This is another attribute that Roslyn uses for its own purposes only.
@MichalStrehovsky MichalStrehovsky added the linkable-framework Issues associated with delivering a linker friendly framework label Jul 12, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 12, 2023
@ghost
Copy link

ghost commented Jul 12, 2023

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

Issue Details

This is another attribute that Roslyn uses for its own purposes only.

Cc @dotnet/illink-contrib (btw what's the difference between this and @dotnet/illink?)

Author: MichalStrehovsky
Assignees: -
Labels:

linkable-framework

Milestone: -

@teo-tsirpanis teo-tsirpanis removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 12, 2023
@@ -320,6 +320,9 @@
<type fullname="System.Runtime.CompilerServices.ScopedRefAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.RefSafetyRulesAttribute">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the C# compiler adds more and more of these, is there a way to keep this list up-to-date, or at least a way to audit when new attributes are added by the C# compiler?

From @333fred - #85612 (comment) lists all the attributes emitted by the compiler.

Also note - a bunch of these attributes are now in CoreLib with #87857.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't strip everything the compiler injects because some of these are "public APIs" (we tell people how to interpret them, like the nullable attributes). Then there's those with unknown purpose like RefSafetyRulesAttribute or EmbeddedAttribute that only mean something to Roslyn.

Roslyn should ideally have a holistic look at this because in 10 years we'll have 20 attributes that cost us 20 kB (need to count IL size, metadata size, readytorun code size) to encode 20 bytes of information in each assembly - #85612 (comment). If we could have a RoslynBreadcrumbsAttribute that takes a byte[] that Roslyn can decode, it might be more space efficient than a new type for every tiny bit of information.

@MichalStrehovsky MichalStrehovsky merged commit 9be6fcc into main Jul 13, 2023
163 of 166 checks passed
@MichalStrehovsky MichalStrehovsky deleted the MichalStrehovsky-patch-3 branch July 13, 2023 04:50
@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants