dotnet/macios

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

Closed this issue · 4 comments

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

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.

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

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

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