summaryrefslogtreecommitdiff
path: root/src/mscorlib
diff options
context:
space:
mode:
authorMarco Rossignoli <marco.rossignoli@gmail.com>2018-04-19 18:54:09 +0200
committerDan Moseley <danmose@microsoft.com>2018-04-19 12:54:09 -0400
commit204c11b8309bf243b9255ddf7f17820cd320cf4d (patch)
treebec48e08e50c60db1953d3738c69477dedb24d84 /src/mscorlib
parentb03e1fe8b5b5fb56d2dcc95f62563c99856255ce (diff)
downloadcoreclr-204c11b8309bf243b9255ddf7f17820cd320cf4d.tar.gz
coreclr-204c11b8309bf243b9255ddf7f17820cd320cf4d.tar.bz2
coreclr-204c11b8309bf243b9255ddf7f17820cd320cf4d.zip
add field Name to exception (#17668)
Diffstat (limited to 'src/mscorlib')
-rw-r--r--src/mscorlib/Resources/Strings.resx4
-rw-r--r--src/mscorlib/src/System/TypedReference.cs6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/mscorlib/Resources/Strings.resx b/src/mscorlib/Resources/Strings.resx
index 2b7c9f54f7..29ebb336d7 100644
--- a/src/mscorlib/Resources/Strings.resx
+++ b/src/mscorlib/Resources/Strings.resx
@@ -782,7 +782,7 @@
<value>A null or zero length string does not represent a valid Type.</value>
</data>
<data name="Arg_TypeRefPrimitve" xml:space="preserve">
- <value>TypedReferences cannot be redefined as primitives.</value>
+ <value>TypedReferences cannot be redefined as primitives. Field name '{0}'.</value>
</data>
<data name="Arg_TypeUnloadedException" xml:space="preserve">
<value>Type had been unloaded.</value>
@@ -1520,7 +1520,7 @@
<value>The DaylightTransitionStart property must not equal the DaylightTransitionEnd property.</value>
</data>
<data name="Argument_TypedReferenceInvalidField" xml:space="preserve">
- <value>Field in TypedReferences cannot be static or init only.</value>
+ <value>Field '{0}' in TypedReferences cannot be static or init only.</value>
</data>
<data name="Argument_TypeIsWinRTType" xml:space="preserve">
<value>The type must not be a Windows Runtime type.</value>
diff --git a/src/mscorlib/src/System/TypedReference.cs b/src/mscorlib/src/System/TypedReference.cs
index 1a378d4d88..748f2db461 100644
--- a/src/mscorlib/src/System/TypedReference.cs
+++ b/src/mscorlib/src/System/TypedReference.cs
@@ -29,7 +29,7 @@ namespace System
if (flds == null)
throw new ArgumentNullException(nameof(flds));
if (flds.Length == 0)
- throw new ArgumentException(SR.Arg_ArrayZeroError);
+ throw new ArgumentException(SR.Arg_ArrayZeroError, nameof(flds));
IntPtr[] fields = new IntPtr[flds.Length];
// For proper handling of Nullable<T> don't change GetType() to something like 'IsAssignableFrom'
@@ -42,14 +42,14 @@ namespace System
throw new ArgumentException(SR.Argument_MustBeRuntimeFieldInfo);
if (field.IsInitOnly || field.IsStatic)
- throw new ArgumentException(SR.Argument_TypedReferenceInvalidField);
+ throw new ArgumentException(SR.Format(SR.Argument_TypedReferenceInvalidField, field.Name));
if (targetType != field.GetDeclaringTypeInternal() && !targetType.IsSubclassOf(field.GetDeclaringTypeInternal()))
throw new MissingMemberException(SR.MissingMemberTypeRef);
RuntimeType fieldType = (RuntimeType)field.FieldType;
if (fieldType.IsPrimitive)
- throw new ArgumentException(SR.Arg_TypeRefPrimitve);
+ throw new ArgumentException(SR.Format(SR.Arg_TypeRefPrimitve, field.Name));
if (i < (flds.Length - 1) && !fieldType.IsValueType)
throw new MissingMemberException(SR.MissingMemberNestErr);