From fe76a4a1a6b30db26c5198afa3cc976997c7d7c4 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 8 Apr 2026 10:22:16 +0200 Subject: [PATCH 1/8] Fix test failures on iOS, tvOS, and MacCatalyst - PlatformDetection.IsMethodBodySupported: use IsBuiltWithAggressiveTrimming to exclude platforms where IL bodies are stripped (NativeAOT, Apple mobile) - ProcessTests.Start_Disposed_ThrowsObjectDisposedException: skip on iOS/tvOS/MacCatalyst where Process.Start throws PlatformNotSupportedException before checking disposed state - CustomMethodInfoTests/CustomConstructorInfoTests: guard GetMethodImplementationFlags_ReturnsIL with IsMethodBodySupported since AOT IL stripping changes flags from IL to NoInlining Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Common/tests/TestUtilities/System/PlatformDetection.cs | 2 +- src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs | 1 + .../tests/CustomConstructorInfoTests.cs | 2 +- .../System.Reflection.Context/tests/CustomMethodInfoTests.cs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 97dac4bbe7ea70..9ddda52552f2d4 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -267,7 +267,7 @@ private static bool GetLinqExpressionsBuiltWithIsInterpretingOnly() public static bool IsAssemblyLoadingSupported => !IsNativeAot; public static bool IsNonBundledAssemblyLoadingSupported => IsAssemblyLoadingSupported && !IsMonoAOT; - public static bool IsMethodBodySupported => !IsNativeAot; + public static bool IsMethodBodySupported => !IsBuiltWithAggressiveTrimming; public static bool IsDebuggerTypeProxyAttributeSupported => !IsNativeAot; public static bool HasAssemblyFiles => !string.IsNullOrEmpty(typeof(PlatformDetection).Assembly.Location); public static bool HasHostExecutable => HasAssemblyFiles; // single-file don't have a host diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index 78c2169536a01e..81ab9cf94734f6 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -1792,6 +1792,7 @@ public void Start_RedirectStandardOutput_StartAgain_DoesntThrow() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Process.Start is not supported on iOS, tvOS, and MacCatalyst.")] public void Start_Disposed_ThrowsObjectDisposedException() { var process = new Process(); diff --git a/src/libraries/System.Reflection.Context/tests/CustomConstructorInfoTests.cs b/src/libraries/System.Reflection.Context/tests/CustomConstructorInfoTests.cs index de6e57cbc4c3af..c86856e50cbae1 100644 --- a/src/libraries/System.Reflection.Context/tests/CustomConstructorInfoTests.cs +++ b/src/libraries/System.Reflection.Context/tests/CustomConstructorInfoTests.cs @@ -155,7 +155,7 @@ public void GetMethodBody_ReturnsBody() Assert.NotNull(body); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsMethodBodySupported))] public void GetMethodImplementationFlags_ReturnsIL() { MethodImplAttributes flags = _customConstructor.GetMethodImplementationFlags(); diff --git a/src/libraries/System.Reflection.Context/tests/CustomMethodInfoTests.cs b/src/libraries/System.Reflection.Context/tests/CustomMethodInfoTests.cs index 8fd1c1d63d7400..4256b0e24c8fce 100644 --- a/src/libraries/System.Reflection.Context/tests/CustomMethodInfoTests.cs +++ b/src/libraries/System.Reflection.Context/tests/CustomMethodInfoTests.cs @@ -187,7 +187,7 @@ public void GetMethodBody_ReturnsBodyWithLocals() Assert.NotNull(body.LocalVariables); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsMethodBodySupported))] public void GetMethodImplementationFlags_ReturnsIL() { MethodImplAttributes flags = _customMethod.GetMethodImplementationFlags(); From 06faffb6bc4ebe6e0562dd600840ace284d63b01 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 8 Apr 2026 10:35:03 +0200 Subject: [PATCH 2/8] Fix runtime tests --- src/tests/build.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/build.proj b/src/tests/build.proj index 6a80d792c1ae1b..3c6673c0260747 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -174,6 +174,7 @@ <_RestoreProperties>MSBuildRestoreSessionId=$([System.Guid]::NewGuid());TargetOS=$(TargetOS);TargetArchitecture=$(TargetArchitecture);Configuration=$(Configuration);CrossBuild=$(CrossBuild);SetTFMForRestore=true;RuntimeIdentifier=$(RuntimeIdentifier) <_RestoreProperties Condition="'$(UseLocalAppHostPack)' == 'true' or '$(TargetOS)' == 'browser'">$(_RestoreProperties);EnableAppHostPackDownload=false;EnableTargetingPackDownload=false;EnableRuntimePackDownload=false + <_RestoreProperties Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst'">$(_RestoreProperties);RestoreUseStaticGraphEvaluation=false From 3f6dcd42865ade6323f5f02c9427320ec524b1e3 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 8 Apr 2026 10:35:39 +0200 Subject: [PATCH 3/8] Update src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index 81ab9cf94734f6..6ceb5a0e7e7a9d 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -1792,7 +1792,7 @@ public void Start_RedirectStandardOutput_StartAgain_DoesntThrow() } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Process.Start is not supported on iOS, tvOS, and MacCatalyst.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Process.Start is not supported on iOS and tvOS.")] public void Start_Disposed_ThrowsObjectDisposedException() { var process = new Process(); From eb964438183af116f952f9f0d0349ade47639011 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 8 Apr 2026 10:41:45 +0200 Subject: [PATCH 4/8] Skip UserNameCantBeCombinedWithInheritedHandles on Apple mobile Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../System.Diagnostics.Process/tests/ProcessStartInfoTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs index ef27eacf7f1102..0225473d1ace6d 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -1446,6 +1446,7 @@ public void StartInfo_LoadUserProfile_And_UseCredentialsForNetworkingOnly_AreInc } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Process.Start is not supported on iOS, tvOS, and MacCatalyst.")] public void UserNameCantBeCombinedWithInheritedHandles() { using Process longRunning = CreateProcessLong(); From 8bd3e7bba4e36fc3ac7b50804c8bc5fd8e7203c4 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 8 Apr 2026 14:45:28 +0200 Subject: [PATCH 5/8] Gate GetMethodImplementationFlags tests on IsNotMonoRuntime instead of IsMethodBodySupported These tests check method implementation flags, not method bodies. Mono IL stripping changes flags from IL to NoInlining, but R2R IL stripping does not. Skip on Mono only to preserve NativeAOT coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../tests/CustomConstructorInfoTests.cs | 2 +- .../System.Reflection.Context/tests/CustomMethodInfoTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Reflection.Context/tests/CustomConstructorInfoTests.cs b/src/libraries/System.Reflection.Context/tests/CustomConstructorInfoTests.cs index c86856e50cbae1..ceb4b7ace553f6 100644 --- a/src/libraries/System.Reflection.Context/tests/CustomConstructorInfoTests.cs +++ b/src/libraries/System.Reflection.Context/tests/CustomConstructorInfoTests.cs @@ -155,7 +155,7 @@ public void GetMethodBody_ReturnsBody() Assert.NotNull(body); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsMethodBodySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime))] public void GetMethodImplementationFlags_ReturnsIL() { MethodImplAttributes flags = _customConstructor.GetMethodImplementationFlags(); diff --git a/src/libraries/System.Reflection.Context/tests/CustomMethodInfoTests.cs b/src/libraries/System.Reflection.Context/tests/CustomMethodInfoTests.cs index 4256b0e24c8fce..6f21db84123e91 100644 --- a/src/libraries/System.Reflection.Context/tests/CustomMethodInfoTests.cs +++ b/src/libraries/System.Reflection.Context/tests/CustomMethodInfoTests.cs @@ -187,7 +187,7 @@ public void GetMethodBody_ReturnsBodyWithLocals() Assert.NotNull(body.LocalVariables); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsMethodBodySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime))] public void GetMethodImplementationFlags_ReturnsIL() { MethodImplAttributes flags = _customMethod.GetMethodImplementationFlags(); From d8f9cdd8019fb51eac04d9173c80ee1a86de624a Mon Sep 17 00:00:00 2001 From: vitek-karas <10670590+vitek-karas@users.noreply.github.com> Date: Wed, 8 Apr 2026 15:59:32 +0200 Subject: [PATCH 6/8] [Apple mobile] Disable TraceSource config tests under aggressive trimming Add the active issue for the aggressive-trimming failure tracked by #126635. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../TraceSourceWithConfigurationTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs b/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs index 1b523f9e88d019..10ed26cd8e6bbb 100644 --- a/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs +++ b/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs @@ -10,6 +10,7 @@ namespace System.Diagnostics.TraceSourceConfigTests { // Note that parallelization is disabled due to file access as each test replaces the single config file on disk. + [ActiveIssue("https://github.com/dotnet/runtime/issues/126635", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming))] public class ConfigurationTests { private static volatile string? _configFile = null; From 9443cea32cddbd45ecd0262782181ddd757b393c Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 9 Apr 2026 12:22:34 +0200 Subject: [PATCH 7/8] Update src/tests/build.proj Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/tests/build.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/build.proj b/src/tests/build.proj index 3c6673c0260747..e8455e5df74964 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -174,7 +174,7 @@ <_RestoreProperties>MSBuildRestoreSessionId=$([System.Guid]::NewGuid());TargetOS=$(TargetOS);TargetArchitecture=$(TargetArchitecture);Configuration=$(Configuration);CrossBuild=$(CrossBuild);SetTFMForRestore=true;RuntimeIdentifier=$(RuntimeIdentifier) <_RestoreProperties Condition="'$(UseLocalAppHostPack)' == 'true' or '$(TargetOS)' == 'browser'">$(_RestoreProperties);EnableAppHostPackDownload=false;EnableTargetingPackDownload=false;EnableRuntimePackDownload=false - <_RestoreProperties Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst'">$(_RestoreProperties);RestoreUseStaticGraphEvaluation=false + <_RestoreProperties Condition="'$(TargetsAppleMobile)' == 'true'">$(_RestoreProperties);RestoreUseStaticGraphEvaluation=false From 0ad7258febe6a02136a1778aaa8a082adab52574 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 9 Apr 2026 22:16:34 +0200 Subject: [PATCH 8/8] Skip TraceSource config tests on Apple mobile CoreCLR via tests.proj Instead of using a class-level ActiveIssue with IsBuiltWithAggressiveTrimming (which also suppresses NativeAOT), exclude the entire project from compilation and Helix submission for Apple mobile CoreCLR. All individual tests already have ActiveIssue for iOS/tvOS/Android, so zero tests would run anyway. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../TraceSourceWithConfigurationTests.cs | 1 - src/libraries/tests.proj | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs b/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs index 10ed26cd8e6bbb..1b523f9e88d019 100644 --- a/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs +++ b/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs @@ -10,7 +10,6 @@ namespace System.Diagnostics.TraceSourceConfigTests { // Note that parallelization is disabled due to file access as each test replaces the single config file on disk. - [ActiveIssue("https://github.com/dotnet/runtime/issues/126635", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming))] public class ConfigurationTests { private static volatile string? _configFile = null; diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 3bbf424f11e50e..49757f74fb48fd 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -698,6 +698,9 @@ + + +