Skip to content

Commit 4f5659d

Browse files
authored
Fix interface trimming order (#110098)
ProcessMarkedTypesWithInterfaces can lead to additional interface methods being required, so those need to be marked (done by ProcessInterfaceMethods) even if nothing else happens to put new items in the queue.
1 parent 05cd31b commit 4f5659d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/tools/illink/src/linker/Linker.Steps/MarkStep.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ bool ProcessPrimaryQueue ()
415415

416416
while (!QueueIsEmpty ()) {
417417
ProcessQueue ();
418-
ProcessInterfaceMethods ();
419418
ProcessMarkedTypesWithInterfaces ();
419+
ProcessInterfaceMethods ();
420420
ProcessDynamicCastableImplementationInterfaces ();
421421
ProcessPendingBodies ();
422422
DoAdditionalProcessing ();

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
66
{
77
[SetupCSharpCompilerToUse ("csc")]
88
[SetupLinkerArgument ("--used-attrs-only", "true")]
9+
10+
// Necessary to allow trimming the attribute instance from types in CoreLib.
11+
[SetupLinkerTrimMode ("link")]
12+
// When we allow trimming CoreLib, some well-known types expected by ILVerify are removed.
13+
[SkipILVerify]
914
public class MethodWithUnmanagedConstraint
1015
{
1116
public static void Main ()

0 commit comments

Comments
 (0)