summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Moseley <danmose@microsoft.com>2019-06-19 01:28:30 -0700
committerGitHub <noreply@github.com>2019-06-19 01:28:30 -0700
commit15ece8e1b587edd35af4c092e30e8666b2d9e66f (patch)
treea871066c960475ee87034f52ecd2f8fc9a0be19f
parent70febbad4bbe23326c26480b2848cdfe9fc8450c (diff)
downloadcoreclr-15ece8e1b587edd35af4c092e30e8666b2d9e66f.tar.gz
coreclr-15ece8e1b587edd35af4c092e30e8666b2d9e66f.tar.bz2
coreclr-15ece8e1b587edd35af4c092e30e8666b2d9e66f.zip
Exception format cleanup subset (#25185)
* Change ArgumentException message to one line * Disable 2 tests * Remove duplication in AggregateException.ToString() * Inner exceptions on new lines * Caps letter * Typo
-rw-r--r--src/System.Private.CoreLib/Resources/Strings.resx2
-rw-r--r--src/System.Private.CoreLib/shared/System/AggregateException.cs6
-rw-r--r--src/System.Private.CoreLib/shared/System/ArgumentException.cs7
-rw-r--r--src/System.Private.CoreLib/shared/System/BadImageFormatException.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Exception.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/IO/FileLoadException.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/IO/FileNotFoundException.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Runtime/InteropServices/COMException.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/Runtime/InteropServices/ExternalException.cs2
-rw-r--r--tests/CoreFX/CoreFX.issues.rsp4
10 files changed, 21 insertions, 14 deletions
diff --git a/src/System.Private.CoreLib/Resources/Strings.resx b/src/System.Private.CoreLib/Resources/Strings.resx
index 48cbbcffc8..3bd8d5abf9 100644
--- a/src/System.Private.CoreLib/Resources/Strings.resx
+++ b/src/System.Private.CoreLib/Resources/Strings.resx
@@ -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>
diff --git a/src/System.Private.CoreLib/shared/System/AggregateException.cs b/src/System.Private.CoreLib/shared/System/AggregateException.cs
index 08cda7c388..d19a70e546 100644
--- a/src/System.Private.CoreLib/shared/System/AggregateException.cs
+++ b/src/System.Private.CoreLib/shared/System/AggregateException.cs
@@ -451,8 +451,10 @@ namespace System
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("<---");
diff --git a/src/System.Private.CoreLib/shared/System/ArgumentException.cs b/src/System.Private.CoreLib/shared/System/ArgumentException.cs
index 6e38c7b3f2..a803b1a426 100644
--- a/src/System.Private.CoreLib/shared/System/ArgumentException.cs
+++ b/src/System.Private.CoreLib/shared/System/ArgumentException.cs
@@ -81,11 +81,10 @@ namespace System
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;
}
}
diff --git a/src/System.Private.CoreLib/shared/System/BadImageFormatException.cs b/src/System.Private.CoreLib/shared/System/BadImageFormatException.cs
index 23aa56453b..913e2b9e3a 100644
--- a/src/System.Private.CoreLib/shared/System/BadImageFormatException.cs
+++ b/src/System.Private.CoreLib/shared/System/BadImageFormatException.cs
@@ -104,7 +104,7 @@ namespace System
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;
diff --git a/src/System.Private.CoreLib/shared/System/Exception.cs b/src/System.Private.CoreLib/shared/System/Exception.cs
index 2f07ca2aba..30b808d966 100644
--- a/src/System.Private.CoreLib/shared/System/Exception.cs
+++ b/src/System.Private.CoreLib/shared/System/Exception.cs
@@ -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 = " ---> ";
+
public Exception()
{
_HResult = HResults.COR_E_EXCEPTION;
@@ -151,7 +153,7 @@ namespace System
if (_innerException != null)
{
- s = s + " ---> " + _innerException.ToString() + Environment.NewLine +
+ s = s + Environment.NewLine + InnerExceptionPrefix + _innerException.ToString() + Environment.NewLine +
" " + SR.Exception_EndOfInnerExceptionStack;
}
diff --git a/src/System.Private.CoreLib/shared/System/IO/FileLoadException.cs b/src/System.Private.CoreLib/shared/System/IO/FileLoadException.cs
index 729d480d95..30f02786ed 100644
--- a/src/System.Private.CoreLib/shared/System/IO/FileLoadException.cs
+++ b/src/System.Private.CoreLib/shared/System/IO/FileLoadException.cs
@@ -64,7 +64,7 @@ namespace System.IO
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;
diff --git a/src/System.Private.CoreLib/shared/System/IO/FileNotFoundException.cs b/src/System.Private.CoreLib/shared/System/IO/FileNotFoundException.cs
index 0ce1c74da3..334325b40a 100644
--- a/src/System.Private.CoreLib/shared/System/IO/FileNotFoundException.cs
+++ b/src/System.Private.CoreLib/shared/System/IO/FileNotFoundException.cs
@@ -78,7 +78,7 @@ namespace System.IO
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;
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/COMException.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/COMException.cs
index 2dec6b8ffb..1b66bb6379 100644
--- a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/COMException.cs
+++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/COMException.cs
@@ -48,7 +48,7 @@ namespace System.Runtime.InteropServices
public override string ToString()
{
StringBuilder s = new StringBuilder();
-
+
string className = GetType().ToString();
s.Append(className).Append(" (0x").Append(HResult.ToString("X8", CultureInfo.InvariantCulture)).Append(')');
@@ -61,7 +61,7 @@ namespace System.Runtime.InteropServices
Exception? innerException = InnerException;
if (innerException != null)
{
- s.Append(" ---> ").Append(innerException.ToString());
+ s.Append(Environment.NewLine).Append(InnerExceptionPrefix).Append(innerException.ToString());
}
string? stackTrace = StackTrace;
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/ExternalException.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/ExternalException.cs
index d587d820a7..9028288b10 100644
--- a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/ExternalException.cs
+++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/ExternalException.cs
@@ -75,7 +75,7 @@ namespace System.Runtime.InteropServices
Exception? innerException = InnerException;
if (innerException != null)
{
- s = s + " ---> " + innerException.ToString();
+ s = s + Environment.NewLine + InnerExceptionPrefix + innerException.ToString();
}
if (StackTrace != null)
diff --git a/tests/CoreFX/CoreFX.issues.rsp b/tests/CoreFX/CoreFX.issues.rsp
index 8a35ea39f6..40c0fd49b3 100644
--- a/tests/CoreFX/CoreFX.issues.rsp
+++ b/tests/CoreFX/CoreFX.issues.rsp
@@ -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