diff options
Diffstat (limited to 'src/mscorlib/src/System/Reflection/CustomAttribute.cs')
-rw-r--r-- | src/mscorlib/src/System/Reflection/CustomAttribute.cs | 168 |
1 files changed, 39 insertions, 129 deletions
diff --git a/src/mscorlib/src/System/Reflection/CustomAttribute.cs b/src/mscorlib/src/System/Reflection/CustomAttribute.cs index 463c976357..e568a1702f 100644 --- a/src/mscorlib/src/System/Reflection/CustomAttribute.cs +++ b/src/mscorlib/src/System/Reflection/CustomAttribute.cs @@ -29,7 +29,7 @@ namespace System.Reflection public static IList<CustomAttributeData> GetCustomAttributes(MemberInfo target) { if (target == null) - throw new ArgumentNullException("target"); + throw new ArgumentNullException(nameof(target)); return target.GetCustomAttributesData(); } @@ -37,7 +37,7 @@ namespace System.Reflection public static IList<CustomAttributeData> GetCustomAttributes(Module target) { if (target == null) - throw new ArgumentNullException("target"); + throw new ArgumentNullException(nameof(target)); Contract.EndContractBlock(); return target.GetCustomAttributesData(); @@ -46,7 +46,7 @@ namespace System.Reflection public static IList<CustomAttributeData> GetCustomAttributes(Assembly target) { if (target == null) - throw new ArgumentNullException("target"); + throw new ArgumentNullException(nameof(target)); Contract.EndContractBlock(); return target.GetCustomAttributesData(); @@ -55,7 +55,7 @@ namespace System.Reflection public static IList<CustomAttributeData> GetCustomAttributes(ParameterInfo target) { if (target == null) - throw new ArgumentNullException("target"); + throw new ArgumentNullException(nameof(target)); Contract.EndContractBlock(); return target.GetCustomAttributesData(); @@ -63,10 +63,9 @@ namespace System.Reflection #endregion #region Internal Static Members - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeType target) { - Contract.Assert(target != null); + Debug.Assert(target != null); IList<CustomAttributeData> cad = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); @@ -86,10 +85,9 @@ namespace System.Reflection return Array.AsReadOnly(pca); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeFieldInfo target) { - Contract.Assert(target != null); + Debug.Assert(target != null); IList<CustomAttributeData> cad = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); @@ -109,10 +107,9 @@ namespace System.Reflection return Array.AsReadOnly(pca); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeMethodInfo target) { - Contract.Assert(target != null); + Debug.Assert(target != null); IList<CustomAttributeData> cad = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); @@ -132,34 +129,30 @@ namespace System.Reflection return Array.AsReadOnly(pca); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeConstructorInfo target) { - Contract.Assert(target != null); + Debug.Assert(target != null); return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target) { - Contract.Assert(target != null); + Debug.Assert(target != null); return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimePropertyInfo target) { - Contract.Assert(target != null); + Debug.Assert(target != null); return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeModule target) { - Contract.Assert(target != null); + Debug.Assert(target != null); if (target.IsResource()) return new List<CustomAttributeData>(); @@ -167,10 +160,9 @@ namespace System.Reflection return GetCustomAttributes(target, target.MetadataToken); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeAssembly target) { - Contract.Assert(target != null); + Debug.Assert(target != null); IList<CustomAttributeData> cad = GetCustomAttributes((RuntimeModule)target.ManifestModule, RuntimeAssembly.GetToken(target.GetNativeHandle())); @@ -190,10 +182,9 @@ namespace System.Reflection return Array.AsReadOnly(pca); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeParameterInfo target) { - Contract.Assert(target != null); + Debug.Assert(target != null); IList<CustomAttributeData> cad = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); @@ -279,7 +270,7 @@ namespace System.Reflection if (type.IsValueType) return CustomAttributeEncoding.Undefined; - throw new ArgumentException(Environment.GetResourceString("Argument_InvalidKindOfTypeForCA"), "type"); + throw new ArgumentException(Environment.GetResourceString("Argument_InvalidKindOfTypeForCA"), nameof(type)); } private static CustomAttributeType InitCustomAttributeType(RuntimeType parameterType) { @@ -302,7 +293,6 @@ namespace System.Reflection return new CustomAttributeType(encodedType, encodedArrayType, encodedEnumType, enumName); } - [System.Security.SecurityCritical] // auto-generated private static IList<CustomAttributeData> GetCustomAttributes(RuntimeModule module, int tkTarget) { CustomAttributeRecord[] records = GetCustomAttributeRecords(module, tkTarget); @@ -316,7 +306,6 @@ namespace System.Reflection #endregion #region Internal Static Members - [System.Security.SecurityCritical] // auto-generated internal unsafe static CustomAttributeRecord[] GetCustomAttributeRecords(RuntimeModule module, int targetToken) { MetadataImport scope = module.MetadataImport; @@ -369,7 +358,6 @@ namespace System.Reflection { } - [System.Security.SecuritySafeCritical] // auto-generated private CustomAttributeData(RuntimeModule scope, CustomAttributeRecord caRecord) { m_scope = scope; @@ -611,7 +599,7 @@ namespace System.Reflection public CustomAttributeNamedArgument(MemberInfo memberInfo, object value) { if (memberInfo == null) - throw new ArgumentNullException("memberInfo"); + throw new ArgumentNullException(nameof(memberInfo)); Type type = null; FieldInfo field = memberInfo as FieldInfo; @@ -631,7 +619,7 @@ namespace System.Reflection public CustomAttributeNamedArgument(MemberInfo memberInfo, CustomAttributeTypedArgument typedArgument) { if (memberInfo == null) - throw new ArgumentNullException("memberInfo"); + throw new ArgumentNullException(nameof(memberInfo)); m_memberInfo = memberInfo; m_value = typedArgument; @@ -749,11 +737,10 @@ namespace System.Reflection return typeof(object); default : - throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)encodedType), "encodedType"); + throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)encodedType), nameof(encodedType)); } } - [SecuritySafeCritical] private static object EncodedValueToRawValue(long val, CustomAttributeEncoding encodedType) { switch (encodedType) @@ -795,7 +782,7 @@ namespace System.Reflection unsafe { return *(double*)&val; } default: - throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)val), "val"); + throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)val), nameof(val)); } } private static RuntimeType ResolveType(RuntimeModule scope, string typeName) @@ -820,7 +807,7 @@ namespace System.Reflection { // value can be null. if (argumentType == null) - throw new ArgumentNullException("argumentType"); + throw new ArgumentNullException(nameof(argumentType)); m_value = (value == null) ? null : CanonicalizeValue(value); m_argumentType = argumentType; @@ -830,7 +817,7 @@ namespace System.Reflection { // value cannot be null. if (value == null) - throw new ArgumentNullException("value"); + throw new ArgumentNullException(nameof(value)); m_value = CanonicalizeValue(value); m_argumentType = value.GetType(); @@ -838,7 +825,7 @@ namespace System.Reflection private static object CanonicalizeValue(object value) { - Contract.Assert(value != null); + Debug.Assert(value != null); if (value.GetType().IsEnum) { @@ -852,7 +839,7 @@ namespace System.Reflection CustomAttributeEncoding encodedType = encodedArg.CustomAttributeType.EncodedType; if (encodedType == CustomAttributeEncoding.Undefined) - throw new ArgumentException("encodedArg"); + throw new ArgumentException(null, nameof(encodedArg)); else if (encodedType == CustomAttributeEncoding.Enum) { @@ -1015,7 +1002,6 @@ namespace System.Reflection internal struct CustomAttributeEncodedArgument { #region Parser - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ParseAttributeArguments( IntPtr pCa, @@ -1024,18 +1010,17 @@ namespace System.Reflection ref CustomAttributeNamedParameter[] CustomAttributeTypedArgument, RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated internal static void ParseAttributeArguments(ConstArray attributeBlob, ref CustomAttributeCtorParameter[] customAttributeCtorParameters, ref CustomAttributeNamedParameter[] customAttributeNamedParameters, RuntimeModule customAttributeModule) { if (customAttributeModule == null) - throw new ArgumentNullException("customAttributeModule"); + throw new ArgumentNullException(nameof(customAttributeModule)); Contract.EndContractBlock(); - Contract.Assert(customAttributeCtorParameters != null); - Contract.Assert(customAttributeNamedParameters != null); + Debug.Assert(customAttributeCtorParameters != null); + Debug.Assert(customAttributeNamedParameters != null); if (customAttributeCtorParameters.Length != 0 || customAttributeNamedParameters.Length != 0) { @@ -1083,7 +1068,7 @@ namespace System.Reflection public CustomAttributeNamedParameter(string argumentName, CustomAttributeEncoding fieldOrProperty, CustomAttributeType type) { if (argumentName == null) - throw new ArgumentNullException("argumentName"); + throw new ArgumentNullException(nameof(argumentName)); Contract.EndContractBlock(); m_argumentName = argumentName; @@ -1131,11 +1116,9 @@ namespace System.Reflection IntPtr m_Next; IntPtr m_Assembly; - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern void Push(RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public extern void Pop(); @@ -1183,7 +1166,6 @@ namespace System.Reflection #endregion #region Internal Static Members - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeType type, RuntimeType caType, bool inherit) { Contract.Requires(type != null); @@ -1213,7 +1195,6 @@ namespace System.Reflection return false; } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType caType, bool inherit) { Contract.Requires(method != null); @@ -1241,7 +1222,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType) { Contract.Requires(ctor != null); @@ -1253,7 +1233,6 @@ namespace System.Reflection return IsCustomAttributeDefined(ctor.GetRuntimeModule(), ctor.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimePropertyInfo property, RuntimeType caType) { Contract.Requires(property != null); @@ -1265,7 +1244,6 @@ namespace System.Reflection return IsCustomAttributeDefined(property.GetRuntimeModule(), property.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType) { Contract.Requires(e != null); @@ -1277,7 +1255,6 @@ namespace System.Reflection return IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType) { Contract.Requires(field != null); @@ -1289,7 +1266,6 @@ namespace System.Reflection return IsCustomAttributeDefined(field.GetRuntimeModule(), field.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType) { Contract.Requires(parameter != null); @@ -1301,7 +1277,6 @@ namespace System.Reflection return IsCustomAttributeDefined(parameter.GetRuntimeModule(), parameter.MetadataToken, caType); } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsDefined(RuntimeAssembly assembly, RuntimeType caType) { Contract.Requires(assembly != null); @@ -1313,7 +1288,6 @@ namespace System.Reflection return IsCustomAttributeDefined(assembly.ManifestModule as RuntimeModule, RuntimeAssembly.GetToken(assembly.GetNativeHandle()), caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeModule module, RuntimeType caType) { Contract.Requires(module != null); @@ -1325,7 +1299,6 @@ namespace System.Reflection return IsCustomAttributeDefined(module, module.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit) { Contract.Requires(type != null); @@ -1388,7 +1361,7 @@ namespace System.Reflection else { type = type.DeclaringType as RuntimeType; - Contract.Assert(type != null); + Debug.Assert(type != null); } } @@ -1397,16 +1370,7 @@ namespace System.Reflection private static bool SpecialAllowCriticalAttributes(RuntimeType type) { - // Types participating in Type Equivalence are always transparent. - // See TokenSecurityDescriptor::VerifySemanticDataComputed in securitymeta.cpp. - // Because of that we allow critical attributes applied to full trust equivalent types. - // DeclaringType is null for global methods and fields and the global type never participates in type equivalency. - -#if FEATURE_CORECLR return false; -#else - return type != null && type.Assembly.IsFullyTrusted && RuntimeTypeHandle.IsEquivalentType(type); -#endif //!FEATURE_CORECLR } private static bool AllowCriticalCustomAttributes(MethodBase method) @@ -1429,7 +1393,6 @@ namespace System.Reflection return AllowCriticalCustomAttributes(parameter.DefiningMethod); } - [System.Security.SecurityCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool inherit) { Contract.Requires(method != null); @@ -1474,7 +1437,6 @@ namespace System.Reflection return typedResult; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType) { Contract.Requires(ctor != null); @@ -1487,7 +1449,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType) { Contract.Requires(property != null); @@ -1506,7 +1467,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType) { Contract.Requires(e != null); @@ -1524,7 +1484,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType) { Contract.Requires(field != null); @@ -1537,7 +1496,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType) { Contract.Requires(parameter != null); @@ -1550,7 +1508,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) { Contract.Requires(assembly != null); @@ -1565,7 +1522,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeModule module, RuntimeType caType) { Contract.Requires(module != null); @@ -1579,20 +1535,17 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] internal static bool IsAttributeDefined(RuntimeModule decoratedModule, int decoratedMetadataToken, int attributeCtorToken) { return IsCustomAttributeDefined(decoratedModule, decoratedMetadataToken, null, attributeCtorToken, false); } - [System.Security.SecurityCritical] // auto-generated private static bool IsCustomAttributeDefined( RuntimeModule decoratedModule, int decoratedMetadataToken, RuntimeType attributeFilterType) { return IsCustomAttributeDefined(decoratedModule, decoratedMetadataToken, attributeFilterType, 0, false); } - [System.Security.SecurityCritical] // auto-generated private static bool IsCustomAttributeDefined( RuntimeModule decoratedModule, int decoratedMetadataToken, RuntimeType attributeFilterType, int attributeCtorToken, bool mustBeInheritable) { @@ -1604,7 +1557,7 @@ namespace System.Reflection if (attributeFilterType != null) { - Contract.Assert(attributeCtorToken == 0); + Debug.Assert(attributeCtorToken == 0); MetadataImport scope = decoratedModule.MetadataImport; RuntimeType attributeType; @@ -1627,8 +1580,8 @@ namespace System.Reflection } else { - Contract.Assert(attributeFilterType == null); - Contract.Assert(!MetadataToken.IsNullToken(attributeCtorToken)); + Debug.Assert(attributeFilterType == null); + Debug.Assert(!MetadataToken.IsNullToken(attributeCtorToken)); for (int i = 0; i < car.Length; i++) { @@ -1642,14 +1595,12 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated private unsafe static object[] GetCustomAttributes( RuntimeModule decoratedModule, int decoratedMetadataToken, int pcaCount, RuntimeType attributeFilterType, bool isDecoratedTargetSecurityTransparent) { return GetCustomAttributes(decoratedModule, decoratedMetadataToken, pcaCount, attributeFilterType, false, null, isDecoratedTargetSecurityTransparent); } - [System.Security.SecurityCritical] private unsafe static object[] GetCustomAttributes( RuntimeModule decoratedModule, int decoratedMetadataToken, int pcaCount, RuntimeType attributeFilterType, bool mustBeInheritable, IList derivedAttributes, bool isDecoratedTargetSecurityTransparent) @@ -1841,7 +1792,6 @@ namespace System.Reflection return result; } - [System.Security.SecurityCritical] // auto-generated private unsafe static bool FilterCustomAttributeRecord( CustomAttributeRecord caRecord, MetadataImport scope, @@ -1885,19 +1835,6 @@ namespace System.Reflection return false; } -#if FEATURE_APTCA - // APTCA checks - RuntimeAssembly attributeAssembly = (RuntimeAssembly)attributeType.Assembly; - RuntimeAssembly decoratedModuleAssembly = (RuntimeAssembly)decoratedModule.Assembly; - - if (attributeAssembly != lastAptcaOkAssembly && - !RuntimeAssembly.AptcaCheck(attributeAssembly, decoratedModuleAssembly)) - return false; - - // Cache last successful APTCA check (optimization) - lastAptcaOkAssembly = decoratedModuleAssembly; -#endif // FEATURE_APTCA - // Resolve the attribute ctor ConstArray ctorSig = scope.GetMethodSignature(caRecord.tkCtor); isVarArg = (ctorSig[0] & 0x05) != 0; @@ -1944,7 +1881,7 @@ namespace System.Reflection else { // We need to relax this when we add support for other types of decorated tokens. - Contract.Assert(decoratedToken.IsModule || decoratedToken.IsAssembly, + Debug.Assert(decoratedToken.IsModule || decoratedToken.IsAssembly, "The decoratedToken must be either an assembly, a module, a type, or a member."); } @@ -1959,7 +1896,6 @@ namespace System.Reflection #endregion #region Private Static Methods - [System.Security.SecurityCritical] // auto-generated private static bool AttributeUsageCheck( RuntimeType attributeType, bool mustBeInheritable, object[] attributes, IList derivedAttributes) { @@ -1992,7 +1928,6 @@ namespace System.Reflection return true; } - [System.Security.SecurityCritical] // auto-generated internal static AttributeUsageAttribute GetAttributeUsage(RuntimeType decoratedAttribute) { RuntimeModule decoratedModule = decoratedAttribute.GetRuntimeModule(); @@ -2027,11 +1962,9 @@ namespace System.Reflection #endregion #region Private Static FCalls - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _ParseAttributeUsageAttribute( IntPtr pCa, int cCa, out int targets, out bool inherited, out bool allowMultiple); - [System.Security.SecurityCritical] // auto-generated private static void ParseAttributeUsageAttribute( ConstArray ca, out AttributeTargets targets, out bool inherited, out bool allowMultiple) { @@ -2040,10 +1973,8 @@ namespace System.Reflection targets = (AttributeTargets)_targets; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static unsafe extern Object _CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, byte** ppBlob, byte* pEndBlob, int* pcNamedArgs); - [System.Security.SecurityCritical] // auto-generated private static unsafe Object CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, ref IntPtr blob, IntPtr blobEnd, out int namedArgs) { byte* pBlob = (byte*)blob; @@ -2055,11 +1986,9 @@ namespace System.Reflection return ca; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe extern static void _GetPropertyOrFieldData( RuntimeModule pModule, byte** ppBlobStart, byte* pBlobEnd, out string name, out bool bIsProperty, out RuntimeType type, out object value); - [System.Security.SecurityCritical] // auto-generated private unsafe static void GetPropertyOrFieldData( RuntimeModule module, ref IntPtr blobStart, IntPtr blobEnd, out string name, out bool isProperty, out RuntimeType type, out object value) { @@ -2069,7 +1998,6 @@ namespace System.Reflection blobStart = (IntPtr)pBlobStart; } - [System.Security.SecuritySafeCritical] private static object[] CreateAttributeArrayHelper(Type elementType, int elementCount) { return (object[])Array.UnsafeCreateInstance(elementType, elementCount); @@ -2089,18 +2017,13 @@ namespace System.Reflection #endregion #region FCalls - [System.Security.SecurityCritical] // auto-generated - [MethodImplAttribute(MethodImplOptions.InternalCall)] - unsafe private static extern void _GetSecurityAttributes(RuntimeModule module, int token, bool assembly, out object[] securityAttributes); - [System.Security.SecurityCritical] // auto-generated - unsafe internal static void GetSecurityAttributes(RuntimeModule module, int token, bool assembly, out object[] securityAttributes) + internal static void GetSecurityAttributes(RuntimeModule module, int token, bool assembly, out object[] securityAttributes) { - _GetSecurityAttributes(module.GetNativeHandle(), token, assembly, out securityAttributes); + securityAttributes = null; } #endregion #region Static Constructor - [System.Security.SecurityCritical] // auto-generated static PseudoCustomAttribute() { RuntimeType[] pcas = new RuntimeType[] @@ -2130,21 +2053,20 @@ namespace System.Reflection s_pca = temp_pca; } - [System.Security.SecurityCritical] // auto-generated [Conditional("_DEBUG")] private static void VerifyPseudoCustomAttribute(RuntimeType pca) { // If any of these are invariants are no longer true will have to // re-architect the PCA product logic and test cases -- you've been warned! - Contract.Assert(pca.BaseType == (RuntimeType)typeof(Attribute), "Pseudo CA Error"); + Debug.Assert(pca.BaseType == (RuntimeType)typeof(Attribute), "Pseudo CA Error"); AttributeUsageAttribute usage = CustomAttribute.GetAttributeUsage(pca); - Contract.Assert(usage.Inherited == false, "Pseudo CA Error"); + Debug.Assert(usage.Inherited == false, "Pseudo CA Error"); //AllowMultiple is true for TypeForwardedToAttribute - //Contract.Assert(usage.AllowMultiple == false, "Pseudo CA Error"); + //Debug.Assert(usage.AllowMultiple == false, "Pseudo CA Error"); } - #endregion +#endregion - #region Internal Static +#region Internal Static internal static bool IsSecurityAttribute(RuntimeType type) { #pragma warning disable 618 @@ -2152,7 +2074,6 @@ namespace System.Reflection #pragma warning restore 618 } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool includeSecCa, out int count) { Contract.Requires(type != null); @@ -2196,7 +2117,6 @@ namespace System.Reflection count = pcas.Count; return pcas.ToArray(); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeType type, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2221,7 +2141,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool includeSecCa, out int count) { Contract.Requires(method != null); @@ -2260,7 +2179,6 @@ namespace System.Reflection count = pcas.Count; return pcas.ToArray(); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2286,7 +2204,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType, out int count) { Contract.Requires(parameter != null); @@ -2323,7 +2240,6 @@ namespace System.Reflection } return pcas; } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2351,7 +2267,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType, bool includeSecCa, out int count) { count = 0; @@ -2386,7 +2301,6 @@ namespace System.Reflection count = pcas.Count; return pcas.ToArray(); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeAssembly assembly, RuntimeType caType) { int count; @@ -2403,7 +2317,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType, out int count) { Contract.Requires(field != null); @@ -2435,7 +2348,6 @@ namespace System.Reflection } return pcas; } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2458,7 +2370,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType, bool includeSecCa, out int count) { count = 0; @@ -2484,7 +2395,6 @@ namespace System.Reflection count = pcas.Count; return pcas.ToArray(); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2522,6 +2432,6 @@ namespace System.Reflection { return false; } - #endregion +#endregion } } |