diff options
author | Zoltan Varga <vargaz@gmail.com> | 2019-03-11 15:16:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-11 15:16:21 +0300 |
commit | db67d18d0da569040883ac6c380403c794b2d824 (patch) | |
tree | 67d5af2203a606a8b1fafca11b1f37bbe461d6be /mcs/class/referencesource | |
parent | 38a2639fc1a2f5c4ec6ecc2479b8c9b0941ef077 (diff) |
[netcore] Ongoing work. (#13391)
* [runtime] Add a few new m_class inline functions.
* [netcore] Implement Array.IndexOf ().
* [netcore] Implement RuntimeHelpers.PrepareMethod ().
* Add error checks to RuntimeHelpers.GetUninitializedObject ().
* Fix some type attributes.
* Fix some TypedReference special cases.
Diffstat (limited to 'mcs/class/referencesource')
-rw-r--r-- | mcs/class/referencesource/mscorlib/system/typedreference.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mcs/class/referencesource/mscorlib/system/typedreference.cs b/mcs/class/referencesource/mscorlib/system/typedreference.cs index 534fa305379..3b71114749e 100644 --- a/mcs/class/referencesource/mscorlib/system/typedreference.cs +++ b/mcs/class/referencesource/mscorlib/system/typedreference.cs @@ -44,7 +44,7 @@ namespace System { throw new ArgumentNullException("flds"); Contract.EndContractBlock(); if (flds.Length == 0) - throw new ArgumentException(Environment.GetResourceString("Arg_ArrayZeroError")); + throw new ArgumentException(Environment.GetResourceString("Arg_ArrayZeroError"), nameof (flds)); IntPtr[] fields = new IntPtr[flds.Length]; // For proper handling of Nullable<T> don't change GetType() to something like 'IsAssignableFrom' @@ -56,8 +56,13 @@ namespace System { if (field == null) throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeFieldInfo")); +#if NETCORE + if (field.IsStatic) + throw new ArgumentException(Environment.GetResourceString("Argument_TypedReferenceInvalidField")); +#else if (field.IsInitOnly || field.IsStatic) throw new ArgumentException(Environment.GetResourceString("Argument_TypedReferenceInvalidField")); +#endif if (targetType != field.GetDeclaringTypeInternal() && !targetType.IsSubclassOf(field.GetDeclaringTypeInternal())) throw new MissingMemberException(Environment.GetResourceString("MissingMemberTypeRef")); |