diff options
Diffstat (limited to 'src/mscorlib/src/System/Reflection/FieldInfo.cs')
-rw-r--r-- | src/mscorlib/src/System/Reflection/FieldInfo.cs | 98 |
1 files changed, 6 insertions, 92 deletions
diff --git a/src/mscorlib/src/System/Reflection/FieldInfo.cs b/src/mscorlib/src/System/Reflection/FieldInfo.cs index c6a44d412b..e61207a686 100644 --- a/src/mscorlib/src/System/Reflection/FieldInfo.cs +++ b/src/mscorlib/src/System/Reflection/FieldInfo.cs @@ -15,9 +15,6 @@ namespace System.Reflection using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; -#if FEATURE_REMOTING - using System.Runtime.Remoting.Metadata; -#endif //FEATURE_REMOTING using System.Runtime.Serialization; using System.Security.Permissions; using System.Threading; @@ -26,9 +23,6 @@ namespace System.Reflection [Serializable] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_FieldInfo))] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")] -#pragma warning restore 618 [System.Runtime.InteropServices.ComVisible(true)] public abstract class FieldInfo : MemberInfo, _FieldInfo { @@ -36,7 +30,7 @@ namespace System.Reflection public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle) { if (handle.IsNullHandle()) - throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"), "handle"); + throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"), nameof(handle)); FieldInfo f = RuntimeType.GetFieldInfo(handle.GetRuntimeFieldInfo()); @@ -186,35 +180,6 @@ namespace System.Reflection } #endregion - -#if !FEATURE_CORECLR - Type _FieldInfo.GetType() - { - return base.GetType(); - } - - void _FieldInfo.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _FieldInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _FieldInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _FieldInfo.Invoke in VM\DangerousAPIs.h and - // include _FieldInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _FieldInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } [Serializable] @@ -239,36 +204,6 @@ namespace System.Reflection } #endregion -#if FEATURE_REMOTING - #region Legacy Remoting Cache - // The size of CachedData is accounted for by BaseObjectWithCachedData in object.h. - // This member is currently being used by Remoting for caching remoting data. If you - // need to cache data here, talk to the Remoting team to work out a mechanism, so that - // both caching systems can happily work together. - private RemotingFieldCachedData m_cachedData; - - internal RemotingFieldCachedData RemotingCache - { - get - { - // This grabs an internal copy of m_cachedData and uses - // that instead of looking at m_cachedData directly because - // the cache may get cleared asynchronously. This prevents - // us from having to take a lock. - RemotingFieldCachedData cache = m_cachedData; - if (cache == null) - { - cache = new RemotingFieldCachedData(this); - RemotingFieldCachedData ret = Interlocked.CompareExchange(ref m_cachedData, cache, null); - if (ret != null) - cache = ret; - } - return cache; - } - } - #endregion -#endif //FEATURE_REMOTING - #region NonPublic Members internal BindingFlags BindingFlags { get { return m_bindingFlags; } } private RuntimeType ReflectedTypeInternal @@ -325,28 +260,27 @@ namespace System.Reflection public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) - throw new ArgumentNullException("attributeType"); + throw new ArgumentNullException(nameof(attributeType)); Contract.EndContractBlock(); RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType; if (attributeRuntimeType == null) - throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"),"attributeType"); + throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"),nameof(attributeType)); return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) - throw new ArgumentNullException("attributeType"); + throw new ArgumentNullException(nameof(attributeType)); Contract.EndContractBlock(); RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType; if (attributeRuntimeType == null) - throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"),"attributeType"); + throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"),nameof(attributeType)); return CustomAttribute.IsDefined(this, attributeRuntimeType); } @@ -362,11 +296,10 @@ namespace System.Reflection #endregion #region ISerializable Implementation - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) - throw new ArgumentNullException("info"); + throw new ArgumentNullException(nameof(info)); Contract.EndContractBlock(); MemberInfoSerializationHolder.GetSerializationInfo( info, @@ -382,7 +315,6 @@ namespace System.Reflection internal unsafe sealed class RtFieldInfo : RuntimeFieldInfo, IRuntimeFieldInfo { #region FCalls - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static private extern void PerformVisibilityCheckOnField(IntPtr field, Object target, RuntimeType declaringType, FieldAttributes attr, uint invocationFlags); #endregion @@ -480,7 +412,6 @@ namespace System.Reflection private RuntimeAssembly GetRuntimeAssembly() { return m_declaringType.GetRuntimeAssembly(); } #region Constructor - [System.Security.SecurityCritical] // auto-generated internal RtFieldInfo( RuntimeFieldHandleInternal handle, RuntimeType declaringType, RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags) : base(reflectedTypeCache, declaringType, bindingFlags) @@ -493,7 +424,6 @@ namespace System.Reflection #region Private Members RuntimeFieldHandleInternal IRuntimeFieldInfo.Value { - [System.Security.SecuritySafeCritical] get { return new RuntimeFieldHandleInternal(m_fieldHandle); @@ -535,7 +465,6 @@ namespace System.Reflection return m.m_fieldHandle == m_fieldHandle; } - [System.Security.SecurityCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal void InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, ref StackCrawlMark stackMark) @@ -592,7 +521,6 @@ namespace System.Reflection // InternalSetValue() instead. When the caller needs to perform // consistency checks they should call CheckConsistency() before // calling this method. - [System.Security.SecurityCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal void UnsafeSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) @@ -614,7 +542,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal Object InternalGetValue(Object obj, ref StackCrawlMark stackMark) @@ -657,7 +584,6 @@ namespace System.Reflection // InternalGetValue() instead. When the caller needs to perform // consistency checks they should call CheckConsistency() before // calling this method. - [System.Security.SecurityCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal Object UnsafeGetValue(Object obj) @@ -685,7 +611,6 @@ namespace System.Reflection #region MemberInfo Overrides public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_name == null) @@ -705,11 +630,9 @@ namespace System.Reflection public override int MetadataToken { - [System.Security.SecuritySafeCritical] // auto-generated get { return RuntimeFieldHandle.GetToken(this); } } - [System.Security.SecuritySafeCritical] // auto-generated internal override RuntimeModule GetRuntimeModule() { return RuntimeTypeHandle.GetModule(RuntimeFieldHandle.GetApproxDeclaringType(this)); @@ -726,7 +649,6 @@ namespace System.Reflection public override object GetRawConstantValue() { throw new InvalidOperationException(); } - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] public override Object GetValueDirect(TypedReference obj) @@ -742,7 +664,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) @@ -751,7 +672,6 @@ namespace System.Reflection InternalSetValue(obj, value, invokeAttr, binder, culture, ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] public override void SetValueDirect(TypedReference obj, Object value) @@ -793,7 +713,6 @@ namespace System.Reflection public override Type FieldType { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_fieldType == null) @@ -803,13 +722,11 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated public override Type[] GetRequiredCustomModifiers() { return new Signature(this, m_declaringType).GetCustomModifiers(1, true); } - [System.Security.SecuritySafeCritical] // auto-generated public override Type[] GetOptionalCustomModifiers() { return new Signature(this, m_declaringType).GetCustomModifiers(1, false); @@ -857,7 +774,6 @@ namespace System.Reflection #region MemberInfo Overrides public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_name == null) @@ -902,7 +818,6 @@ namespace System.Reflection public unsafe override Object GetRawConstantValue() { return GetValue(true); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe Object GetValue(bool raw) { // Cannot cache these because they could be user defined non-agile enumerations @@ -924,7 +839,6 @@ namespace System.Reflection public override Type FieldType { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_fieldType == null) |