Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/System.Private.CoreLib/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@
<value>Insufficient memory to continue the execution of the program.</value>
</data>
<data name="Arg_ParamName_Name" xml:space="preserve">
<value>Parameter name: {0}</value>
<value>(Parameter '{0}')</value>
</data>
<data name="Arg_ParmArraySize" xml:space="preserve">
<value>Must specify one or more parameters.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,10 @@ public override string ToString()

for (int i = 0; i < m_innerExceptions.Count; i++)
{
text.AppendLine();
text.Append("---> ");
if (m_innerExceptions[i] == InnerException)
continue; // Already logged in base.ToString()

text.Append(Environment.NewLine).Append(InnerExceptionPrefix);
text.AppendFormat(CultureInfo.InvariantCulture, SR.AggregateException_InnerException, i);
text.Append(m_innerExceptions[i].ToString());
text.Append("<---");
Expand Down
7 changes: 3 additions & 4 deletions src/System.Private.CoreLib/shared/System/ArgumentException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,10 @@ public override string Message
string s = base.Message;
if (!string.IsNullOrEmpty(_paramName))
{
string resourceString = SR.Format(SR.Arg_ParamName_Name, _paramName);
return s + Environment.NewLine + resourceString;
s += " " + SR.Format(SR.Arg_ParamName_Name, _paramName);
}
else
return s;

return s;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public override string ToString()
s += Environment.NewLine + SR.Format(SR.IO_FileName_Name, _fileName);

if (InnerException != null)
s = s + " ---> " + InnerException.ToString();
s = s + InnerExceptionPrefix + InnerException.ToString();

if (StackTrace != null)
s += Environment.NewLine + StackTrace;
Expand Down
4 changes: 3 additions & 1 deletion src/System.Private.CoreLib/shared/System/Exception.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace System
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public partial class Exception : ISerializable
{
internal protected const string InnerExceptionPrefix = " ---> ";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danmosemsft, did you mean for this to be private protected rather than internal protected? As it stands it's exposing this all derived types. It's thus also breaking the corefx build.


public Exception()
{
_HResult = HResults.COR_E_EXCEPTION;
Expand Down Expand Up @@ -151,7 +153,7 @@ public override string ToString()

if (_innerException != null)
{
s = s + " ---> " + _innerException.ToString() + Environment.NewLine +
s = s + Environment.NewLine + InnerExceptionPrefix + _innerException.ToString() + Environment.NewLine +
" " + SR.Exception_EndOfInnerExceptionStack;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public override string ToString()
s += Environment.NewLine + SR.Format(SR.IO_FileName_Name, FileName);

if (InnerException != null)
s = s + " ---> " + InnerException.ToString();
s = s + Environment.NewLine + InnerExceptionPrefix + InnerException.ToString();

if (StackTrace != null)
s += Environment.NewLine + StackTrace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public override string ToString()
s += Environment.NewLine + SR.Format(SR.IO_FileName_Name, FileName);

if (InnerException != null)
s = s + " ---> " + InnerException.ToString();
s = s + Environment.NewLine + InnerExceptionPrefix + InnerException.ToString();

if (StackTrace != null)
s += Environment.NewLine + StackTrace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected COMException(SerializationInfo info, StreamingContext context) : base(
public override string ToString()
{
StringBuilder s = new StringBuilder();

string className = GetType().ToString();
s.Append(className).Append(" (0x").Append(HResult.ToString("X8", CultureInfo.InvariantCulture)).Append(')');

Expand All @@ -61,7 +61,7 @@ public override string ToString()
Exception? innerException = InnerException;
if (innerException != null)
{
s.Append(" ---> ").Append(innerException.ToString());
s.Append(Environment.NewLine).Append(InnerExceptionPrefix).Append(innerException.ToString());
}

string? stackTrace = StackTrace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override string ToString()
Exception? innerException = InnerException;
if (innerException != null)
{
s = s + " ---> " + innerException.ToString();
s = s + Environment.NewLine + InnerExceptionPrefix + innerException.ToString();
}

if (StackTrace != null)
Expand Down
4 changes: 4 additions & 0 deletions tests/CoreFX/CoreFX.issues.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
# Assert: https://github.com/dotnet/coreclr/issues/25050
-nonamespace System.Data.Common.Tests

# requires corefx test updates
-nomethod System.Data.Tests.Common.DbConnectionStringBuilderTest.Add_Keyword_Invalid
-nomethod System.Data.Tests.Common.DbConnectionStringBuilderTest.Indexer_Keyword_Invalid

# requires corefx test updates https://github.com/dotnet/corefx/pull/38452
-nomethod System.SpanTests.ReadOnlySpanTests.ZeroLengthIndexOfAny_ManyInteger
-nomethod System.SpanTests.ReadOnlySpanTests.ZeroLengthIndexOfAny_ManyString
Expand Down