From 21bc1bf1618f39566580fc895cca3e3d2634ea8d Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 17 Apr 2026 11:09:56 +0200 Subject: [PATCH 1/3] [ios-clr] Preserve PDBs for CoreCLR and fix StackTrace tests on Apple mobile AppleAppBuilder.Xcode strips .pdb files from the app bundle in optimized builds, leaving CoreCLR iOS/tvOS stack traces without file or symbol information. Keep .pdb for CoreCLR. With PDBs preserved, StackFrameTests.Ctor_FNeedFileInfo and DiagnosticMethodInfoTests.Create_OpenDelegate pass; the remaining StackTraceTests formatting gap (full file + line info) is still tracked by #124087, extend the existing Android-style empty-file-info pattern to Apple mobile. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../tests/DiagnosticMethodInfoTests.cs | 3 ++- .../System.Diagnostics.StackTrace/tests/StackFrameTests.cs | 1 - .../System.Diagnostics.StackTrace/tests/StackTraceTests.cs | 4 ++-- src/libraries/tests.proj | 1 - src/tasks/AppleAppBuilder/Xcode.cs | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/DiagnosticMethodInfoTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/DiagnosticMethodInfoTests.cs index 98bfd84ffb5ba8..d40deeec4a2f51 100644 --- a/src/libraries/System.Diagnostics.StackTrace/tests/DiagnosticMethodInfoTests.cs +++ b/src/libraries/System.Diagnostics.StackTrace/tests/DiagnosticMethodInfoTests.cs @@ -23,7 +23,7 @@ public void Create_Null() public static IEnumerable Create_OpenDelegate_TestData() { // Tracked at https://github.com/dotnet/runtime/issues/100748 - bool hasGvmOpenDelegateBug = !PlatformDetection.IsMonoRuntime && !PlatformDetection.IsNativeAot && !PlatformDetection.IsAppleMobile; + bool hasGvmOpenDelegateBug = !PlatformDetection.IsMonoRuntime && !PlatformDetection.IsNativeAot; const string TestNamespace = nameof(System) + "." + nameof(System.Diagnostics) + "." + nameof(System.Diagnostics.Tests) + "."; @@ -71,6 +71,7 @@ public static IEnumerable Create_OpenDelegate_TestData() } [Theory] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))] [MemberData(nameof(Create_OpenDelegate_TestData))] public void Create_OpenDelegate(Delegate del, string expectedName, string expectedTypeName) { diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/StackFrameTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/StackFrameTests.cs index 02689dede3a119..c1476ae2cf60df 100644 --- a/src/libraries/System.Diagnostics.StackTrace/tests/StackFrameTests.cs +++ b/src/libraries/System.Diagnostics.StackTrace/tests/StackFrameTests.cs @@ -37,7 +37,6 @@ public void Ctor_FNeedFileInfo(bool fNeedFileInfo) [Theory] [ActiveIssue("https://github.com/mono/mono/issues/15187", TestRuntimes.Mono)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile))] [InlineData(StackFrame.OFFSET_UNKNOWN, true)] [InlineData(0, true)] [InlineData(1, true)] diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs index 0145acfb9aecd8..e7897b28a0fae7 100644 --- a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs +++ b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs @@ -603,10 +603,10 @@ public void ToString_ShowILOffset_ByteArrayLoad() } } - // On Android, stack traces do not include file names and line numbers + // On Android and Apple mobile, stack traces do not include file names and line numbers // Tracking issue: https://github.com/dotnet/runtime/issues/124087 private static string FileInfoPattern(string fileLinePattern) => - PlatformDetection.IsAndroid ? "" : fileLinePattern; + PlatformDetection.IsAndroid || PlatformDetection.IsAppleMobile ? "" : fileLinePattern; public static Dictionary MethodExceptionStrings = new() { diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 43615ce89c8823..94cbe3ca167fd9 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -687,7 +687,6 @@ - diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 89d4f19a4102db..7e9c5b38bda061 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -288,7 +288,7 @@ public string GenerateCMake( { predefinedExcludes.Add(".dylib"); } - if (optimized) + if (optimized && targetRuntime != TargetRuntime.CoreCLR) { predefinedExcludes.Add(".pdb"); } From ace9ec6747827b1fb8eff2ec0b3f214d08888164 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 20 Apr 2026 15:36:06 +0200 Subject: [PATCH 2/3] [ios-clr] Update stack trace file info pattern for Android mobile platform --- .../System.Diagnostics.StackTrace/tests/StackTraceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs index e7897b28a0fae7..79e8dd9852d4d6 100644 --- a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs +++ b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs @@ -603,10 +603,10 @@ public void ToString_ShowILOffset_ByteArrayLoad() } } - // On Android and Apple mobile, stack traces do not include file names and line numbers + // On Android mobile, stack traces do not include file names and line numbers // Tracking issue: https://github.com/dotnet/runtime/issues/124087 private static string FileInfoPattern(string fileLinePattern) => - PlatformDetection.IsAndroid || PlatformDetection.IsAppleMobile ? "" : fileLinePattern; + PlatformDetection.IsAndroid ? "" : fileLinePattern; public static Dictionary MethodExceptionStrings = new() { From 849fae0cf3cefbabe1eb5dec0187acb1b874cf18 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 21 Apr 2026 10:15:06 +0200 Subject: [PATCH 3/3] Update stack trace file info pattern for Android and Apple mobile platforms --- .../System.Diagnostics.StackTrace/tests/StackTraceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs index 79e8dd9852d4d6..e7897b28a0fae7 100644 --- a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs +++ b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs @@ -603,10 +603,10 @@ public void ToString_ShowILOffset_ByteArrayLoad() } } - // On Android mobile, stack traces do not include file names and line numbers + // On Android and Apple mobile, stack traces do not include file names and line numbers // Tracking issue: https://github.com/dotnet/runtime/issues/124087 private static string FileInfoPattern(string fileLinePattern) => - PlatformDetection.IsAndroid ? "" : fileLinePattern; + PlatformDetection.IsAndroid || PlatformDetection.IsAppleMobile ? "" : fileLinePattern; public static Dictionary MethodExceptionStrings = new() {