From f939860de8b57349b1f25e485b039016c51bbed4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 04:25:15 +0000 Subject: [PATCH 1/2] Initial plan From cd285a6c450713dffd0064431215108004700a6d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 05:04:54 +0000 Subject: [PATCH 2/2] Use platform-appropriate line endings in native assembly chain construction and remove managed ReplaceLineEndings() normalization Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/f53f4e08-76fb-4fb1-bfb2-c79be29bf11e Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com> --- src/coreclr/vm/appdomain.cpp | 4 ++++ .../src/System/BadImageFormatException.cs | 2 +- .../System.Private.CoreLib/src/System/IO/FileLoadException.cs | 2 +- .../src/System/IO/FileNotFoundException.cs | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 5a902c22ebafd3..db5b3414d98ab4 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -3053,7 +3053,11 @@ void AppDomain::GetParentAssemblyChain(Assembly *pStartAssembly, SString &chain, StackSString parentName; pParent->GetDisplayName(parentName); +#ifdef TARGET_UNIX chain.Append(W("\n --> ")); +#else + chain.Append(W("\r\n --> ")); +#endif chain.Append(parentName); if (pParent->IsSystem()) diff --git a/src/libraries/System.Private.CoreLib/src/System/BadImageFormatException.cs b/src/libraries/System.Private.CoreLib/src/System/BadImageFormatException.cs index 75d26cd5070eed..f5fdbf1cc402be 100644 --- a/src/libraries/System.Private.CoreLib/src/System/BadImageFormatException.cs +++ b/src/libraries/System.Private.CoreLib/src/System/BadImageFormatException.cs @@ -101,7 +101,7 @@ public override string ToString() s += Environment.NewLineConst + SR.Format(SR.IO_FileName_Name, _fileName); if (!string.IsNullOrEmpty(_requestingAssemblyChain)) - s += Environment.NewLineConst + SR.Format(SR.IO_FileLoad_RequestedBy, _requestingAssemblyChain.ReplaceLineEndings()); + s += Environment.NewLineConst + SR.Format(SR.IO_FileLoad_RequestedBy, _requestingAssemblyChain); if (InnerException != null) s += InnerExceptionPrefix + InnerException.ToString(); diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileLoadException.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileLoadException.cs index 040a4bcbc11ad3..41a4472ad50030 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileLoadException.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileLoadException.cs @@ -56,7 +56,7 @@ public override string ToString() s += Environment.NewLineConst + SR.Format(SR.IO_FileName_Name, FileName); if (!string.IsNullOrEmpty(_requestingAssemblyChain)) - s += Environment.NewLineConst + SR.Format(SR.IO_FileLoad_RequestedBy, _requestingAssemblyChain.ReplaceLineEndings()); + s += Environment.NewLineConst + SR.Format(SR.IO_FileLoad_RequestedBy, _requestingAssemblyChain); if (InnerException != null) s += Environment.NewLineConst + InnerExceptionPrefix + InnerException.ToString(); diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileNotFoundException.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileNotFoundException.cs index 0cb4bc3b1241c3..6793843e246927 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileNotFoundException.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileNotFoundException.cs @@ -79,7 +79,7 @@ public override string ToString() s += Environment.NewLineConst + SR.Format(SR.IO_FileName_Name, FileName); if (!string.IsNullOrEmpty(_requestingAssemblyChain)) - s += Environment.NewLineConst + SR.Format(SR.IO_FileLoad_RequestedBy, _requestingAssemblyChain.ReplaceLineEndings()); + s += Environment.NewLineConst + SR.Format(SR.IO_FileLoad_RequestedBy, _requestingAssemblyChain); if (InnerException != null) s += Environment.NewLineConst + InnerExceptionPrefix + InnerException.ToString();