Skip to content

ILLink produces invalid IL metadata with -b switch and Save assembly mode #86462

@filipnavara

Description

@filipnavara

As part of testing dotnet/macios#18268 we hit an odd case where invalid IL is produced as the output of ILLink, resulting in later crash when post-processing the data with ILStrip. There's actually several issues at play here:

Repro:

  • Download extra-typeref-linker.zip
  • Update the illinktask.dll path in linker.rsp to an absolute path to the included task .dll; the custom task only changes the assembly action to Save since it cannot be done on command line
  • Run dotnet <path to illink.dll> @linker.rsp
  • Check out\extra-typeref.dll with the mdv tool (https://github.com/dotnet/metadata-tools) and observe that there's NFloat type reference that points to non-existent assembly reference

Observations:

  • Tested with .NET 7.0.302 and .NET 8.0 Preview 5 linkers. The issue exists in both. On .NET 8 the original test case produces different linker input and doesn't hit the problem, but the underlying bug still exists.
  • Removing the -b switch from linker.rsp makes the problem go away

cc @rolfbjarne @ivanpovazan

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions