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

[release/6.0.2xx] Propagate Interfaces annotation through Type.BaseType - #2476

Merged
agocke merged 2 commits into
dotnet:release/6.0.2xxfrom
vitek-karas:BaseTypeInterfaces
Jan 7, 2022
Merged

agocke merged 2 commits into
dotnet:release/6.0.2xxfrom
vitek-karas:BaseTypeInterfaces

Conversation

@vitek-karas

Copy link
Copy Markdown
Member

The Interfaces annotation makes sure the type has all interfaces, meaning GetInterfaces reflection call will work on it. That means that all interfaces of the base type are also preserved, so the Interfaces annotation should be propagated to the base type as well.

Fixes #2473.

The Interfaces annotation makes sure the type has all interfaces, meaning `GetInterfaces` reflection call will work on it. That means that all interfaces of the base type are also preserved, so the `Interfaces` annotation should be propagated to the base type as well.
propagatedMemberTypes |= DynamicallyAccessedMemberTypes.PublicProperties;

if (dynamicallyAccessedMemberNode.DynamicallyAccessedMemberTypes.HasFlag (DynamicallyAccessedMemberTypes.Interfaces))
propagatedMemberTypes |= DynamicallyAccessedMemberTypes.Interfaces;

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.

Consider creating a mask here and &'ing, instead of checking each flag individually.

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.

Also, whether inclusion of exclusion is preferred, i.e. if we forget to update this, would we prefer to propagate more or less?

@agocke
agocke merged commit 5b33e3a into dotnet:release/6.0.2xx Jan 7, 2022
@vitek-karas
vitek-karas deleted the BaseTypeInterfaces branch January 7, 2022 10:51
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
…pe (dotnet/linker#2476)

The Interfaces annotation makes sure the type has all interfaces, meaning `GetInterfaces` reflection call will work on it. That means that all interfaces of the base type are also preserved, so the `Interfaces` annotation should be propagated to the base type as well.

Commit migrated from dotnet/linker@5b33e3a
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants