Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Add analyzer for RequiresAssemblyFilesAttribute - #1722

Merged
marek-safar merged 9 commits into
dotnet:masterfrom
mateoatr:sf-analyzer
Jan 20, 2021
Merged

marek-safar merged 9 commits into
dotnet:masterfrom
mateoatr:sf-analyzer

Conversation

@mateoatr

@mateoatr mateoatr commented Jan 4, 2021 •

Copy link
Copy Markdown
Contributor

This adds an analyzer for the proposed attribute, RequiresAssemblyFilesAttribute. Once (if) the attribute is landed in the runtime, the appropriate APIs should be annotated in the runtime libraries and suitable tests should be added in here.

@mateoatr
mateoatr requested review from agocke and tlakollo January 4, 2021 21:40
@mateoatr
mateoatr requested a review from marek-safar as a code owner January 4, 2021 21:40

@tlakollo tlakollo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me

Stop using Linq in HasName
@mateoatr mateoatr changed the title Add analyzer for SingleFileUnsupportedAttribute Add analyzer for RequiresAssemblyFilesAttribute Jan 9, 2021
internal static bool TryGetRequiresAssemblyFileAttribute (this ISymbol symbol, out AttributeData? attribute)
{
attribute = null;
if (symbol.GetAttributes ().FirstOrDefault (attr => attr.AttributeClass is { } attrClass &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The lambda here creates an allocation, and FirstOrDefault requires an additional delegate allocation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed all Linq usages in this file as well - PTAL.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants