diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringTests.cs index 4ec41acad8c125..1f7df0d8f4012a 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringTests.cs @@ -1134,6 +1134,7 @@ public void Replace_NoSuchStringComparison_ThrowsArgumentException(StringCompari } + [UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Test field used only in conditional tests.")] private static readonly StringComparison[] StringComparisons = (StringComparison[])Enum.GetValues(typeof(StringComparison)); [Fact] @@ -1244,6 +1245,7 @@ public static void GetHashCode_NoSuchStringComparison_ThrowsArgumentException(St [Theory] [InlineData("")] // empty string [InlineData("hello")] // non-empty string + [UnconditionalSuppressMessage("AOT", "IL3050", Justification = "DynamicMethod usage is guarded by IsReflectionEmitSupported runtime check.")] public static unsafe void GetPinnableReference_ReturnsSameAsGCHandleAndLegacyFixed(string input) { Assert.NotNull(input); // test shouldn't have null input @@ -1303,6 +1305,7 @@ public static unsafe void GetPinnableReference_ReturnsSameAsGCHandleAndLegacyFix } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] + [UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Test is skipped when reflection emit is not supported.")] public static unsafe void GetPinnableReference_WithNullInput_ThrowsNullRef() { // This test uses an explicit call instead of the normal callvirt that C# would emit. diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/TimeZoneInfoTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/TimeZoneInfoTests.cs index 0067c38562b376..5651efc143224d 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/TimeZoneInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/TimeZoneInfoTests.cs @@ -2172,6 +2172,8 @@ public static void ToSerializedString_FromSerializedString_RoundTrips(TimeZoneIn [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBinaryFormatterSupported))] [MemberData(nameof(SystemTimeZonesTestData))] + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Test is skipped when BinaryFormatter is not supported.")] + [UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Test is skipped when BinaryFormatter is not supported.")] public static void BinaryFormatter_RoundTrips(TimeZoneInfo timeZone) { BinaryFormatter formatter = new BinaryFormatter(); @@ -2187,6 +2189,7 @@ public static void BinaryFormatter_RoundTrips(TimeZoneInfo timeZone) } [Fact] + [UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "Test uses reflection to inspect internal properties for diagnostics.")] public static void TimeZoneInfo_DoesConvertTimeForOldDatesOfTimeZonesWithExceedingMaxRange() { // On some OSes this time zone contains old adjustment rules which have offset higher than 14h