Esempio n. 1
0
        internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
        {
            int count = 0;

            Attribute[] customAttributes1 = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
            bool        isDecoratedTargetSecurityTransparent = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();

            object[] customAttributes2 = CustomAttribute.GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, count, caType, isDecoratedTargetSecurityTransparent);
            if (count > 0)
            {
                Array.Copy((Array)customAttributes1, 0, (Array)customAttributes2, customAttributes2.Length - count, count);
            }
            return(customAttributes2);
        }
        internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
        {
            int count = 0;

            Attribute[] sourceArray = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
            bool        isDecoratedTargetSecurityTransparent = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();

            object[] destinationArray = GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, count, caType, isDecoratedTargetSecurityTransparent);
            if (count > 0)
            {
                Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
            }
            return(destinationArray);
        }
Esempio n. 3
0
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(e, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType));
 }
 internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target)
 {
     return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
 }
Esempio n. 5
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal static Object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
        {
            Contract.Requires(e != null);
            Contract.Requires(caType != null);

            int pcaCount = 0;
            Attribute[] pca = PseudoCustomAttribute.GetCustomAttributes(e, caType, out pcaCount);
            // Since properties and events have no transparency state, logically we should check the declaring types.
            // But then if someone wanted to apply critical attributes on a property/event he would need to make the type critical,
            // which would also implicitly made all the members critical.
            // So we check the containing assembly instead. If the assembly can contain critical code we allow critical attributes on properties/events.
            bool disallowCriticalCustomAttributes = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();
            object[] attributes = GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, pcaCount, caType, disallowCriticalCustomAttributes);
            if (pcaCount > 0) Array.Copy(pca, 0, attributes, attributes.Length - pcaCount, pcaCount);
            return attributes;
        }
Esempio n. 6
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target)
        {
            Contract.Assert(target != null);

            return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
        }
Esempio n. 7
0
        [System.Security.SecurityCritical]  // auto-generated
        internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
        {
            Contract.Requires(e != null);
            Contract.Requires(caType != null);

            if (PseudoCustomAttribute.IsDefined(e, caType))
                return true;

            return IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType);
        }
Esempio n. 8
0
 internal static IList <CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target)
 {
     return(CustomAttributeData.GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken));
 }
        [System.Security.SecurityCritical]  // auto-generated
        internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
        {
            Contract.Requires(e != null);
            Contract.Requires(caType != null);

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage) && caType != null)
            {
                FrameworkEventSource.Log.QueryAttributeIsDefined(caType.GetFullNameForEtw());
            }
#endif

            if (PseudoCustomAttribute.IsDefined(e, caType))
                return true;

            return IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType);
        }
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     return (PseudoCustomAttribute.IsDefined(e, caType) || IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType));
 }
 internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
 {
     int count = 0;
     Attribute[] sourceArray = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
     bool isDecoratedTargetSecurityTransparent = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();
     object[] destinationArray = GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, count, caType, isDecoratedTargetSecurityTransparent);
     if (count > 0)
     {
         Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
     }
     return destinationArray;
 }