-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always show IL2026 for IsTrimmable assemblies (dotnet/linker#2087)
Commit migrated from dotnet/linker@caeaf2a
- Loading branch information
Showing
4 changed files
with
87 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...illink/test/Mono.Linker.Tests.Cases/Warnings/Dependencies/TriggerWarnings_TrimmableLib.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Reflection; | ||
|
||
[assembly: AssemblyMetadata ("IsTrimmable", "True")] | ||
|
||
namespace Mono.Linker.Tests.Cases.Warnings.Dependencies | ||
{ | ||
public class TriggerWarnings_TrimmableLib | ||
{ | ||
public static void Main () | ||
{ | ||
RequirePublicMethods (UnknownType ()); | ||
RUCIntentional (); | ||
} | ||
|
||
static Type UnknownType () => null; | ||
|
||
static void RequirePublicMethods ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type) { } | ||
|
||
[RequiresUnreferencedCode ("RUC warning left in the trimmable assembly.")] | ||
static void RUCIntentional () { } | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...t/Mono.Linker.Tests.Cases/Warnings/WarningsFromTrimmableAssembliesCanSurviveSingleWarn.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
using Mono.Linker.Tests.Cases.Expectations.Metadata; | ||
using Mono.Linker.Tests.Cases.Warnings.Dependencies; | ||
|
||
namespace Mono.Linker.Tests.Cases.Warnings | ||
{ | ||
[SkipKeptItemsValidation] | ||
[SetupCompileBefore ("library.dll", new[] { typeof (TriggerWarnings_TrimmableLib) })] | ||
[SetupLinkerArgument ("--singlewarn")] | ||
[LogContains (".*warning IL2026: .*TriggerWarnings_TrimmableLib.RUCIntentional.*RUC warning left in the trimmable assembly.*", regexMatch: true)] | ||
[LogDoesNotContain ("IL2072")] | ||
[LogContains ("warning IL2104: Assembly 'library' produced trim warnings")] | ||
[LogDoesNotContain ("IL2026")] | ||
public class WarningsFromTrimmableAssembliesCanSurviveSingleWarn | ||
{ | ||
public static void Main () | ||
{ | ||
TriggerWarnings_TrimmableLib.Main (); | ||
} | ||
} | ||
} |