From b5077aa43006446a5a6b88f3d332dd1e839ca68b Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 10 Jun 2026 12:06:16 +0200 Subject: [PATCH 1/4] [clr-ios] Disable failing tests and fix trimming in Apple CoreCLR mobile test suites Disable InvokeWithRefLikeArgs.MethodTakesRefToRefStructAsArg_ThrowsNSE and TensorPrimitives SpanDestinationFunctions_ValueRange on Apple mobile CoreCLR against #124344, and root the typeless System.Runtime facade in the trimmer descriptor so AssemblyLoadWithPublicKey and AssemblyGetForwardedTypesLoadFailure no longer fail to load it from the trimmed app bundle. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs | 1 + .../tests/System.Reflection.Tests/ILLink.Descriptors.xml | 1 + .../System/Reflection/InvokeWithRefLikeArgs.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs index 2cf563faa56bb4..f9ed5e03bb1869 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs @@ -571,6 +571,7 @@ public void SpanDestinationFunctions_SpecialValues(SpanDestinationDelegate tenso [Theory] [MemberData(nameof(SpanDestinationFunctionsToTest))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))] public void SpanDestinationFunctions_ValueRange(SpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { Assert.All(VectorLengthAndIteratedRange(ConvertFromSingle(-100f), ConvertFromSingle(100f), ConvertFromSingle(3f)), arg => diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/ILLink.Descriptors.xml b/src/libraries/System.Runtime/tests/System.Reflection.Tests/ILLink.Descriptors.xml index 4e8f19b9465ccd..92aaa1fe98de63 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/ILLink.Descriptors.xml +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/ILLink.Descriptors.xml @@ -13,6 +13,7 @@ + diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/InvokeWithRefLikeArgs.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/InvokeWithRefLikeArgs.cs index 0ac914dc0cc0d8..2a405457004e56 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/InvokeWithRefLikeArgs.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/InvokeWithRefLikeArgs.cs @@ -37,6 +37,7 @@ public static void MethodTakesRefStructAsArgWithDefaultValue_ThrowsNSE() // Moq heavily utilizes RefEmit, which does not work on most aot workloads [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [SkipOnMono("https://github.com/dotnet/runtime/issues/40738")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))] public static void MethodTakesRefToRefStructAsArg_ThrowsNSE() { // Use a Binder to trick the reflection stack into treating the returned null From fdaf9e674cf421e2e48308f30a42293f7bce0aa3 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 10 Jun 2026 13:09:14 +0200 Subject: [PATCH 2/4] Narrow Tan suppression to omit only the Tan case on Apple mobile CoreCLR Address review feedback: instead of [ActiveIssue] on the whole SpanDestinationFunctions_ValueRange theory, omit only the Tan case from the shared data provider on Apple mobile CoreCLR, preserving ValueRange coverage for the other operations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../tests/TensorPrimitives.Generic.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs index f9ed5e03bb1869..cb795e515956d3 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs @@ -504,7 +504,14 @@ public static IEnumerable SpanDestinationFunctionsToTest() yield return Create(TensorPrimitives.Sinh, T.Sinh, Helpers.DetermineTolerance(doubleTolerance: 1e-14)); yield return Create(TensorPrimitives.SinPi, T.SinPi, Helpers.DetermineTolerance(doubleTolerance: 1e-13, floatTolerance: 1e-4f)); yield return Create(TensorPrimitives.Sqrt, T.Sqrt); - yield return Create(TensorPrimitives.Tan, T.Tan, trigTolerance); + + // Tan on Apple mobile CoreCLR (arm64) differs from the scalar baseline by a few ULPs when FMA + // is used. Tracked by https://github.com/dotnet/runtime/issues/124344. + if (!(PlatformDetection.IsAppleMobile && PlatformDetection.IsCoreCLR)) + { + yield return Create(TensorPrimitives.Tan, T.Tan, trigTolerance); + } + yield return Create(TensorPrimitives.Tanh, T.Tanh); yield return Create(TensorPrimitives.TanPi, T.TanPi); yield return Create(TensorPrimitives.Truncate, T.Truncate); @@ -571,7 +578,6 @@ public void SpanDestinationFunctions_SpecialValues(SpanDestinationDelegate tenso [Theory] [MemberData(nameof(SpanDestinationFunctionsToTest))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))] public void SpanDestinationFunctions_ValueRange(SpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { Assert.All(VectorLengthAndIteratedRange(ConvertFromSingle(-100f), ConvertFromSingle(100f), ConvertFromSingle(3f)), arg => From 33b127f1aba6cb95858a011d456c9603edd87ccd Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 10 Jun 2026 13:11:21 +0200 Subject: [PATCH 3/4] Revert to method-level [ActiveIssue] for SpanDestinationFunctions_ValueRange Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../tests/TensorPrimitives.Generic.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs index cb795e515956d3..f9ed5e03bb1869 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs @@ -504,14 +504,7 @@ public static IEnumerable SpanDestinationFunctionsToTest() yield return Create(TensorPrimitives.Sinh, T.Sinh, Helpers.DetermineTolerance(doubleTolerance: 1e-14)); yield return Create(TensorPrimitives.SinPi, T.SinPi, Helpers.DetermineTolerance(doubleTolerance: 1e-13, floatTolerance: 1e-4f)); yield return Create(TensorPrimitives.Sqrt, T.Sqrt); - - // Tan on Apple mobile CoreCLR (arm64) differs from the scalar baseline by a few ULPs when FMA - // is used. Tracked by https://github.com/dotnet/runtime/issues/124344. - if (!(PlatformDetection.IsAppleMobile && PlatformDetection.IsCoreCLR)) - { - yield return Create(TensorPrimitives.Tan, T.Tan, trigTolerance); - } - + yield return Create(TensorPrimitives.Tan, T.Tan, trigTolerance); yield return Create(TensorPrimitives.Tanh, T.Tanh); yield return Create(TensorPrimitives.TanPi, T.TanPi); yield return Create(TensorPrimitives.Truncate, T.Truncate); @@ -578,6 +571,7 @@ public void SpanDestinationFunctions_SpecialValues(SpanDestinationDelegate tenso [Theory] [MemberData(nameof(SpanDestinationFunctionsToTest))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))] public void SpanDestinationFunctions_ValueRange(SpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { Assert.All(VectorLengthAndIteratedRange(ConvertFromSingle(-100f), ConvertFromSingle(100f), ConvertFromSingle(3f)), arg => From ec4d951997794d528f204d6b17b5d8671853bb9c Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 11 Jun 2026 11:58:17 +0200 Subject: [PATCH 4/4] Disable AssemblyGetForwardedTypesLoadFailure on Apple mobile CoreCLR GetForwardedTypes() does not resolve the forwarded System.Object/BadImageFormatException entries on trimmed Apple CoreCLR app bundles even after rooting the System.Runtime facade, so gate the test against #124344 like the other Apple mobile CoreCLR failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../tests/System.Reflection.Tests/AssemblyTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs index e6f1ebfe40eb91..4445f52b084f08 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs @@ -948,6 +948,7 @@ public static void AssemblyGetForwardedTypes() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/69919", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))] [ActiveIssue("https://github.com/dotnet/runtime/issues/77821", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))] public static void AssemblyGetForwardedTypesLoadFailure() { Assembly a = typeof(TypeInForwardedAssembly).Assembly;