Skip to content

Setting NullabilityInfoContextSupport=false prevents ILLink.Substitutions.xml from being removed from System.Runtime.InteropServices.dll #2661

Open
@rolfbjarne

Description

@rolfbjarne

Test case: consoleapp-d3255da.zip

Repro:

$ make resources-there
dotnet publish /bl /v:quiet /nologo /bl:resources-there.binlog /p:NullabilityInfoContextSupport=false
/usr/local/share/dotnet/sdk/6.0.201/MSBuild.dll /nologo -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/local/share/dotnet/sdk/6.0.201/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/usr/local/share/dotnet/sdk/6.0.201/dotnet.dll -maxcpucount -property:NullabilityInfoContextSupport=false -restore -target:Publish -verbosity:m /v:quiet /bl /bl:resources-there.binlog ./myproject.csproj

Workload updates are available. Run `dotnet workload list` for more information.
monodis --manifest ./bin/Debug/net6.0/osx-x64/publish/System.Runtime.InteropServices.dll
Manifestresource Table (1..2)
1: public 'FxResources.System.Runtime.InteropServices.SR.resources' at offset 0 in current module
2: public 'ILLink.Substitutions.xml' at offset 2505 in current module

Note there are two resources in the ./bin/Debug/net6.0/osx-x64/publish/System.Runtime.InteropServices.dll assembly.

Now try enabling NullabilityInfoContextSupport:

$ make resources-gone
dotnet publish /bl /v:quiet /nologo  /bl:resources-gone.binlog /p:NullabilityInfoContextSupport=true
/usr/local/share/dotnet/sdk/6.0.201/MSBuild.dll /nologo -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/local/share/dotnet/sdk/6.0.201/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/usr/local/share/dotnet/sdk/6.0.201/dotnet.dll -maxcpucount -property:NullabilityInfoContextSupport=true -restore -target:Publish -verbosity:m /v:quiet /bl /bl:resources-gone.binlog ./myproject.csproj

Workload updates are available. Run `dotnet workload list` for more information.
monodis --manifest ./bin/Debug/net6.0/osx-x64/publish/System.Runtime.InteropServices.dll
Manifestresource Table (1..1)
1: public 'FxResources.System.Runtime.InteropServices.SR.resources' at offset 0 in current module

and ILLink.Substitutions.xml has been linked away.

bin logs (remove the .txt extension):

resources-gone.binlog.txt
resources-there.binlog.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions