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

[NativeAOT] Remove unnecessary [DynamicDependency] attributes #18808

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
7 changes: 6 additions & 1 deletion tools/dotnet-linker/ApplyPreserveAttributeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ static bool IsConditionalAttribute (CustomAttribute? attribute)
void PreserveUnconditional (IMetadataTokenProvider provider)
{
Annotations.Mark (provider);
AddDynamicDependencyAttribute (provider);

// We want to add a dynamic dependency attribute to preserve methods and fields
// but not to preserve types while we're marking the chain of declaring types.
if (provider is not TypeDefinition) {
AddDynamicDependencyAttribute (provider);
}

var member = provider as IMemberDefinition;
if (member is null || member.DeclaringType is null)
Expand Down