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

Only warn on duplicate members within a single descriptors file #101574

Merged
merged 5 commits into from
Apr 29, 2024

Conversation

jtschuster
Copy link
Member

In the trimmer we rely on the order of marking to determine if a descriptors file has a duplicate member. As we transition to the dependency analysis framework, the marking order changes, and this exposed scenarios where a descriptors file is found after some items have already been marked. This caused unnecessary IL2025 warnings (Duplicate preserve in descriptor file) to be reported. Instead of using the global marking state, we should keep a per-descriptor-file set of which members are preserved and only report duplicates within that set.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Apr 25, 2024
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Apr 25, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

@MichalStrehovsky
Copy link
Member

This looks good, but I always wondered why we need to warn.

Could this warn in legitimate situations, like embedded descriptors in two different XML files preserving the same thing, or even within the same descriptor if the preservations are under different feature flags and we happen to enable both feature flags at the same time, leading to both being used?

@jtschuster
Copy link
Member Author

This shouldn't warn on the same member being marked in different embedded XML files, a new object is created for each descriptor file with a new _preservedMembers set. However, I think it would warn if the member is listed twice for different feature flags and both are enabled.

I'm fine removing the warnings, I don't see a lot of value in them.

@sbomer
Copy link
Member

sbomer commented Apr 26, 2024

Looks like it was introduced as a convenience to help clean up some descriptor files in dotnet/linker#293. I'm fine with removing them now that we've added feature switches. Another option is to make it an info message instead.

Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@jtschuster jtschuster merged commit 62e7396 into dotnet:main Apr 29, 2024
72 of 77 checks passed
matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
…gle descriptors file (dotnet#101574)

In the trimmer we rely on the order of marking to determine if a descriptors file has a duplicate member. As we transition to the dependency analysis framework, the marking order changes, and this exposed scenarios where a descriptors file is found after some items have already been marked. This caused unnecessary IL2025 warnings (Duplicate preserve in descriptor file) to be reported. Instead of using the global marking state, we will keep a per-descriptor-file set of which members are preserved and only report duplicates within that set.
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
…gle descriptors file (dotnet#101574)

In the trimmer we rely on the order of marking to determine if a descriptors file has a duplicate member. As we transition to the dependency analysis framework, the marking order changes, and this exposed scenarios where a descriptors file is found after some items have already been marked. This caused unnecessary IL2025 warnings (Duplicate preserve in descriptor file) to be reported. Instead of using the global marking state, we will keep a per-descriptor-file set of which members are preserved and only report duplicates within that set.
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
…gle descriptors file (dotnet#101574)

In the trimmer we rely on the order of marking to determine if a descriptors file has a duplicate member. As we transition to the dependency analysis framework, the marking order changes, and this exposed scenarios where a descriptors file is found after some items have already been marked. This caused unnecessary IL2025 warnings (Duplicate preserve in descriptor file) to be reported. Instead of using the global marking state, we will keep a per-descriptor-file set of which members are preserved and only report duplicates within that set.
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants