You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ 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.
This is a bit of a weird case. The System.Runtime.InteropServices.dll has substitutions but also type forwarders.
We try to process substitutions lazily, so only when we need them. That means we only process them if the linker actually processes a method or a field from a given assembly (as nothing else is affected by substitutions).
In the "gone" case the app actually uses some real members from the assembly and so we process the substitutions. Part of this processing is removing the resource from the assembly.
In the "there" case the app doesn't use any member from the assembly, it only uses a type forwarder (System.Runtime.InteropServices.NFloat). In this case we keep the assembly and the type forward in question, but remove everything else from the assembly (there's no types other than <Module>). In this case we don't get to process the substitutions at all (no need) and thus we don't remove them from the assembly.
@sbomer I don't remember the exact details about processing substitutions lazily, but it feels like we should remove the resource from MarkAssembly regardless if we actually need the substitutions. Similarly for linker attributes resource.
but it feels like we should remove the resource from MarkAssembly regardless if we actually need the substitutions. Similarly for linker attributes resource.
Note that this happens not just for the ILLink.Substitutions.xml resource file.
The resource file FxResources.System.Runtime.InteropServices.SR.resources is also present, after linking. It should be removed from the assembly just like others are (e.g. from System.Private.CoreLib.dll) since the option to remove those resources are enabled by default.
Never mind. Processing ILLink.Substitutions.xml should be enough to remove FxResources.System.Runtime.InteropServices.SR.resources
Test case: consoleapp-d3255da.zip
Repro:
Note there are two resources in the ./bin/Debug/net6.0/osx-x64/publish/System.Runtime.InteropServices.dll assembly.
Now try enabling NullabilityInfoContextSupport:
and
ILLink.Substitutions.xml
has been linked away.bin logs (remove the .txt extension):
resources-gone.binlog.txt
resources-there.binlog.txt
The text was updated successfully, but these errors were encountered: