Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<attribute internal="RemoveAttributeInstances" />
</type>

<!-- Microsoft.CodeAnalysis -->
<type fullname="Microsoft.CodeAnalysis.EmbeddedAttribute">
Expand Down