mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 17:44:48 +09:00

Fixes https://github.com/dotnet/runtime/issues/86462 by walking debug info to discover typerefs in the assembly that are only preserved due to debug info. In this case the assembly has the 'save' action, so the reference to the typeref in the debug info is not swept. This means that the presence of the typeref in the final output depends on whether we are linking the PDB. Walking the typeref will preserve the assemblyref that it refers to, fixing the issue. The fix also needs to walk up the parent import scopes, discovered by reproducing the issue in our test infra. The behavior needs to depend on whether we are linking debug symbols, otherwise we will keep the assemblyref (but not the typeref that uses it) when PDBs are present, and the output should not depend on the presence of PDBs. `AssemblyOnlyUsedByUsingSaveAction` tests this case - see comments in there for more detail. This includes some unrelated test infra changes (supporting multiple additional compiler arguments) which were useful for iterating on this, even though they aren't necessary in the final version of the testcases.
26 lines
No EOL
862 B
C#
26 lines
No EOL
862 B
C#
using Mono.Linker.Tests.Cases.Expectations.Assertions;
|
|
using Mono.Linker.Tests.Cases.Expectations.Metadata;
|
|
using Mono.Linker.Tests.Cases.Symbols.Dependencies;
|
|
|
|
namespace Mono.Linker.Tests.Cases.Symbols
|
|
{
|
|
[SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: new[] { "/debug:embedded" }, compilerToUse: "csc")]
|
|
[SetupLinkerLinkSymbols ("true")]
|
|
|
|
[RemovedAssembly ("LibraryWithEmbeddedPdbSymbols.dll")]
|
|
[RemovedSymbols ("LibraryWithEmbeddedPdbSymbols.dll")]
|
|
public class ReferenceWithEmbeddedPdbDeleteActionAndSymbolLinkingEnabled
|
|
{
|
|
static void Main ()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// By not using this method we will cause the trimmer to delete the reference
|
|
/// </summary>
|
|
static void UnusedCodePath ()
|
|
{
|
|
LibraryWithEmbeddedPdbSymbols.SomeMethod ();
|
|
}
|
|
}
|
|
} |