Exemplo n.º 1
0
        void ProcessInternalAttribute(ICustomAttributeProvider provider, string internalAttribute)
        {
            if (internalAttribute != "RemoveAttributeInstances")
            {
                _context.LogWarning($"Unrecognized internal attribute '{internalAttribute}'", 2049, _xmlDocumentLocation);
                return;
            }

            if (provider.MetadataToken.TokenType != TokenType.TypeDef)
            {
                _context.LogWarning($"Internal attribute 'RemoveAttributeInstances' can only be used on a type, but is being used on '{provider}'", 2048, _xmlDocumentLocation);
                return;
            }

            if (!_context.Annotations.IsMarked(provider))
            {
                IEnumerable <Attribute> removeAttributeInstance = new List <Attribute> {
                    new RemoveAttributeInstancesAttribute()
                };
                _attributeInfo.AddInternalAttributes(provider, removeAttributeInstance);
            }
        }