diff options
author | Marco Rossignoli <marco.rossignoli@gmail.com> | 2018-03-05 19:09:24 +0100 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-03-05 10:09:24 -0800 |
commit | 42eb2286478a9a366ab0140e24bae64e488770dd (patch) | |
tree | 9261e3087ecbed6ad716c572c98275584ae6cb04 /src | |
parent | 56d49222361f0244cfcfa3d77b5bb2bfa582ac3f (diff) | |
download | coreclr-42eb2286478a9a366ab0140e24bae64e488770dd.tar.gz coreclr-42eb2286478a9a366ab0140e24bae64e488770dd.tar.bz2 coreclr-42eb2286478a9a366ab0140e24bae64e488770dd.zip |
Scrub error messages for missing arguments(throw new) (#16753)
Diffstat (limited to 'src')
12 files changed, 13 insertions, 16 deletions
diff --git a/src/mscorlib/Resources/Strings.resx b/src/mscorlib/Resources/Strings.resx index db6fc9eb23..2fa5d880b0 100644 --- a/src/mscorlib/Resources/Strings.resx +++ b/src/mscorlib/Resources/Strings.resx @@ -1660,9 +1660,6 @@ <data name="ArgumentNull_Waithandles" xml:space="preserve"> <value>The waitHandles parameter cannot be null.</value> </data> - <data name="ArgumentNull_WithParamName" xml:space="preserve"> - <value>Parameter '{0}' cannot be null.</value> - </data> <data name="ArgumentOutOfRange_ActualValue" xml:space="preserve"> <value>Actual value was {0}.</value> </data> @@ -3718,4 +3715,4 @@ <data name="Argument_OverlapAlignmentMismatch" xml:space="preserve"> <value>Overlapping spans have mismatching alignment.</value> </data> -</root>
\ No newline at end of file +</root> diff --git a/src/mscorlib/shared/System/Globalization/DateTimeFormatInfo.cs b/src/mscorlib/shared/System/Globalization/DateTimeFormatInfo.cs index faa0deac3d..edec75ac85 100644 --- a/src/mscorlib/shared/System/Globalization/DateTimeFormatInfo.cs +++ b/src/mscorlib/shared/System/Globalization/DateTimeFormatInfo.cs @@ -1602,7 +1602,7 @@ namespace System.Globalization result = this.AllYearMonthPatterns; break; default: - throw new ArgumentException(SR.Format_BadFormatSpecifier, nameof(format)); + throw new ArgumentException(SR.Format(SR.Format_BadFormatSpecifier, format), nameof(format)); } return (result); } @@ -1950,7 +1950,7 @@ namespace System.Globalization break; default: - throw new ArgumentException(SR.Format_BadFormatSpecifier, nameof(format)); + throw new ArgumentException(SR.Format(SR.Format_BadFormatSpecifier, format), nameof(format)); } // Clear the token hash table, note that even short dates could require this diff --git a/src/mscorlib/shared/System/Type.cs b/src/mscorlib/shared/System/Type.cs index a0d219ddd4..b57baa869f 100644 --- a/src/mscorlib/shared/System/Type.cs +++ b/src/mscorlib/shared/System/Type.cs @@ -349,7 +349,7 @@ namespace System public static Type MakeGenericMethodParameter(int position) { if (position < 0) - throw new ArgumentException(SR.ArgumentOutOfRange_MustBeNonNegNum, nameof(position)); + throw new ArgumentException(SR.ArgumentOutOfRange_NeedNonNegNum, nameof(position)); return new SignatureGenericMethodParameterType(position); } diff --git a/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs index 94a9becf98..f48a07251a 100644 --- a/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs +++ b/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs @@ -301,7 +301,7 @@ namespace System.Reflection.Emit } if (passedType == typeof(IntPtr) || passedType == typeof(UIntPtr)) { - throw new ArgumentException(SR.Argument_BadParameterTypeForCAB, paramName); + throw new ArgumentException(SR.Format(SR.Argument_BadParameterTypeForCAB, passedType.ToString()), paramName); } } diff --git a/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs index c682b2861d..c22cbe58b7 100644 --- a/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs +++ b/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs @@ -192,7 +192,7 @@ namespace System.Reflection.Emit public override Type GetGenericTypeDefinition() { throw new InvalidOperationException(); } - public override Type MakeGenericType(params Type[] typeArguments) { throw new InvalidOperationException(SR.Arg_NotGenericTypeDefinition); } + public override Type MakeGenericType(params Type[] typeArguments) { throw new InvalidOperationException(SR.Format(SR.Arg_NotGenericTypeDefinition, this.GetType().ToString())); } protected override bool IsValueTypeImpl() { return false; } diff --git a/src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs b/src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs index 471f25feb8..de7ad2c200 100644 --- a/src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs +++ b/src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs @@ -85,7 +85,7 @@ namespace System.Reflection.Emit public override MethodInfo MakeGenericMethod(params Type[] arguments) { - throw new InvalidOperationException(SR.Arg_NotGenericMethodDefinition); + throw new InvalidOperationException(SR.Format(SR.Arg_NotGenericMethodDefinition, this.GetType().ToString())); } public override bool IsGenericMethod { get { return true; } } diff --git a/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs index 961f5d3f4a..4b56048cf2 100644 --- a/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs +++ b/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs @@ -1971,7 +1971,7 @@ namespace System.Reflection.Emit //((m_iAttr & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface)) if (body != null) - throw new InvalidOperationException(SR.InvalidOperation_BadMethodBody); + throw new InvalidOperationException(SR.Format(SR.InvalidOperation_BadMethodBody, meth.Name)); } else if (body == null || body.Length == 0) { diff --git a/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs b/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs index ed2e1be866..e46b051a90 100644 --- a/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs +++ b/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs @@ -220,7 +220,7 @@ namespace System.Reflection.Emit } public override MethodBase DeclaringMethod { get { return null; } } public override Type GetGenericTypeDefinition() { return m_type; } - public override Type MakeGenericType(params Type[] inst) { throw new InvalidOperationException(SR.Arg_NotGenericTypeDefinition); } + public override Type MakeGenericType(params Type[] inst) { throw new InvalidOperationException(SR.Format(SR.Arg_NotGenericTypeDefinition, this.GetType().ToString())); } public override bool IsAssignableFrom(Type c) { throw new NotSupportedException(); } public override bool IsSubclassOf(Type c) diff --git a/src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs b/src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs index 9c406f81cb..e170ac82d5 100644 --- a/src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs +++ b/src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs @@ -70,7 +70,7 @@ namespace System.Reflection.Emit public override MethodInfo MakeGenericMethod(params Type[] typeArgs) { if (!IsGenericMethodDefinition) - throw new InvalidOperationException(SR.Arg_NotGenericMethodDefinition); + throw new InvalidOperationException(SR.Format(SR.Arg_NotGenericMethodDefinition, this.GetType().ToString())); return MethodBuilderInstantiation.MakeGenericMethod(this, typeArgs); } diff --git a/src/mscorlib/src/System/Threading/EventWaitHandle.cs b/src/mscorlib/src/System/Threading/EventWaitHandle.cs index d3db86e4e9..c2ffb8c5b1 100644 --- a/src/mscorlib/src/System/Threading/EventWaitHandle.cs +++ b/src/mscorlib/src/System/Threading/EventWaitHandle.cs @@ -176,7 +176,7 @@ namespace System.Threading #else if (name == null) { - throw new ArgumentNullException(nameof(name), SR.ArgumentNull_WithParamName); + throw new ArgumentNullException(nameof(name)); } if (name.Length == 0) diff --git a/src/mscorlib/src/System/Threading/Mutex.cs b/src/mscorlib/src/System/Threading/Mutex.cs index 27311bfa84..86981b5642 100644 --- a/src/mscorlib/src/System/Threading/Mutex.cs +++ b/src/mscorlib/src/System/Threading/Mutex.cs @@ -129,7 +129,7 @@ namespace System.Threading { if (name == null) { - throw new ArgumentNullException(nameof(name), SR.ArgumentNull_WithParamName); + throw new ArgumentNullException(nameof(name)); } if (name.Length == 0) diff --git a/src/mscorlib/src/System/Threading/Semaphore.cs b/src/mscorlib/src/System/Threading/Semaphore.cs index 6989130cbd..8380c56801 100644 --- a/src/mscorlib/src/System/Threading/Semaphore.cs +++ b/src/mscorlib/src/System/Threading/Semaphore.cs @@ -132,7 +132,7 @@ namespace System.Threading throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives); #else if (name == null) - throw new ArgumentNullException(nameof(name), SR.ArgumentNull_WithParamName); + throw new ArgumentNullException(nameof(name)); if (name.Length == 0) throw new ArgumentException(SR.Argument_EmptyName, nameof(name)); if (name.Length > Interop.Kernel32.MAX_PATH) |