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

[net] The linker does not remove resources from System.Runtime.InteropServices.dll #14257

Closed
spouliot opened this issue Feb 25, 2022 · 4 comments
Labels
bug If an issue is a bug or a pull request a bug fix dotnet An issue or pull request related to .NET (6)
Milestone

Comments

@spouliot
Copy link
Contributor

The System.Runtime.InteropServices.dll assembly is now part of every application for its NFloat type forwarder.

It's linked (code is removed) but the resources files are not removed like other assemblies.

Steps to Reproduce

  1. cd tests/dotnet
  2. make compare

Expected Behavior

Resources from System.Runtime.InteropServices.dll are removed.

Actual Behavior

System.Runtime.InteropServices.dll still contains resources

  • FxResources.System.Runtime.InteropServices.SR.resources
  • ILLink.Substitutions.xml

The later resource has instructions to remove the former resource.

Environment

main

@spouliot
Copy link
Contributor Author

Looks like the substitution xml is never loaded.

I'm guessing that the code path that triggers this is never executed since all, but the type forwarder to NFloat, members are not marked.

So we end up keeping the assembly (for the forwarder) but not removing the resources.

@rolfbjarne rolfbjarne modified the milestone: .NET 6 Feb 28, 2022
@rolfbjarne rolfbjarne added dotnet An issue or pull request related to .NET (6) bug If an issue is a bug or a pull request a bug fix labels Feb 28, 2022
@rolfbjarne
Copy link
Member

Created a repro and filed a linker issue: dotnet/linker#2661

@rolfbjarne rolfbjarne added this to the .NET 7 milestone Feb 28, 2022
@spouliot
Copy link
Contributor Author

spouliot commented Mar 2, 2022

I made a workaround step available here https://github.com/spouliot/extra-sharp-trimmer

@rolfbjarne
Copy link
Member

It doesn't look like there's anything we need to do, this is entirely a linker bug, so I'm closing this issue.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix dotnet An issue or pull request related to .NET (6)
Projects
None yet
Development

No branches or pull requests

2 participants