12 implementations of GetAttributes
GenerateDocumentationAndConfigFiles (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
159public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
159public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.BannedApiAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
159public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
159public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.CSharp (2)
Symbols\PublicModel\PreprocessingSymbol.cs (1)
64ImmutableArray<AttributeData> ISymbol.GetAttributes() => ImmutableArray<AttributeData>.Empty;
Symbols\PublicModel\Symbol.cs (1)
120ImmutableArray<AttributeData> ISymbol.GetAttributes()
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
86public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
159public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1360Private Function ISymbol_GetAttributes() As ImmutableArray(Of AttributeData) Implements ISymbol.GetAttributes
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
159public ImmutableArray<AttributeData> GetAttributes()
Roslyn.Diagnostics.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
159public ImmutableArray<AttributeData> GetAttributes()
Text.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
159public ImmutableArray<AttributeData> GetAttributes()
681 references to GetAttributes
Aspire.Hosting.Analyzers (5)
AppHostAnalyzer.cs (1)
103var attrData = parameter.GetAttributes()
AspireExportAnalyzer.cs (4)
81foreach (var attr in method.GetAttributes()) 143AnalyzeUnionAttribute(context, parameter.GetAttributes(), aspireUnionAttribute, wellKnownTypes, aspireExportAttribute); 513foreach (var attr in type.GetAttributes()) 527foreach (var attr in type.GetAttributes())
ConfigurationSchemaGenerator (3)
ConfigSchemaEmitter.cs (1)
412var attributes = propertySymbol?.GetAttributes();
ConfigSchemaGenerator.cs (1)
60foreach (var attribute in assembly.GetAttributes())
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
674AttributeData? attributeData = property.GetAttributes().FirstOrDefault(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _typeSymbols.ConfigurationKeyNameAttribute));
EventSourceGenerator (1)
EventSourceGenerator.Parser.cs (1)
37foreach (AttributeData attribute in context.TargetSymbol.GetAttributes())
GenerateDocumentationAndConfigFiles (30)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (8)
62method.GetAttributes(), 71CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 88method.GetAttributes(), 115typeParameter.GetAttributes(), 148var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 151.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 164attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg), 167p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (4)
27property.GetAttributes(), 47.Any(static (p, arg) => p.GetAttributes().Any(ShouldRemoveAttribute, arg), arg); 53property.GetAttributes(), 62p.GetAttributes().WhereAsArray(static (a, arg) => !ShouldRemoveAttribute(a, arg), arg: arg),
ILLink.RoslynAnalyzer (5)
ISymbolExtensions.cs (4)
22foreach (var attr in symbol.GetAttributes()) 32foreach (var attr in member.GetAttributes()) 46foreach (var attr in member.GetAttributes()) 228foreach (var attr in methodSymbol.GetAttributes())
RequiresAnalyzerBase.cs (1)
398var assemblyMetadata = refAssembly.GetAttributes().FirstOrDefault(attr =>
Metrics (15)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Metrics.Legacy (15)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.Analyzers.Extra (9)
AsyncMethodWithoutCancellation.cs (1)
131.GetAttributes()
CallAnalysis\Arrays.cs (1)
115if (keyType.GetAttributes().Any(a => a.AttributeClass != null && SymbolEqualityComparer.Default.Equals(a.AttributeClass, flagsAttr)))
CallAnalysis\Fixers\LegacyLoggingFixer.cs (2)
198foreach (var methodAttr in methodSymbol.GetAttributes()) 637foreach (var methodAttr in methodSymbol.GetAttributes())
ConditionalAccessAnalyzer.cs (2)
42if (MaybeNull(propRef.Property.GetAttributes())) 55if (MaybeNull(fieldRef.Field.GetAttributes()))
MakeExeTypesInternalAnalyzer.cs (2)
97foreach (var attr in type.GetAttributes()) 121var attrs = member.GetAttributes();
UsingToStringInLoggersAnalyzer.cs (1)
53return symbol.GetAttributes().Any(a => a.AttributeClass != null && IsLoggerMessageAttribute(a.AttributeClass));
Microsoft.Analyzers.Local (2)
Utilities\SymbolExtensions.cs (2)
39foreach (var a in sym.GetAttributes()) 52foreach (var a in sym.GetAttributes())
Microsoft.AspNetCore.App.Analyzers (13)
Mvc\DetectAmbiguousActionRoutes.cs (1)
216foreach (var attribute in actionSymbol.GetAttributes())
Mvc\DetectOverriddenAuthorizeAttribute.cs (1)
159foreach (var attribute in symbol.GetAttributes())
Mvc\MvcAnalyzer.cs (2)
97foreach (var attribute in methodSymbol.GetAttributes()) 122foreach (var attribute in methodSymbol.GetAttributes())
RouteEmbeddedLanguage\Infrastructure\RoutePatternParametersDetector.cs (1)
87foreach (var attributeData in child.GetAttributes())
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
313foreach (var attribute in symbol.GetAttributes())
RouteHandlers\DetectMisplacedLambdaAttribute.cs (1)
40var attributes = methodSymbol.GetAttributes();
src\Shared\Roslyn\CodeAnalysisExtensions.cs (2)
23foreach (var declaredAttribute in symbol.GetAttributes()) 133foreach (var declaredAttribute in symbol.GetAttributes())
src\Shared\RoslynUtils\SymbolExtensions.cs (4)
54foreach (var attributeData in symbol.GetAttributes()) 76if (current.GetAttributes().Any(attr => 111foreach (var attributeData in symbol.GetAttributes()) 151return symbol.GetAttributes().TryGetAttributeInheritingFrom(baseType, out matchedAttribute);
Microsoft.AspNetCore.Components.Analyzers (6)
ComponentFacts.cs (6)
25return property.GetAttributes().Any(a => 43return property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute)); 58var attribute = property.GetAttributes().FirstOrDefault(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute)); 87return property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.CascadingParameterAttribute)); 107return property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.SupplyParameterFromFormAttribute)); 127return property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.PersistentStateAttribute));
Microsoft.AspNetCore.Components.SdkAnalyzers (4)
ComponentFacts.cs (4)
25return property.GetAttributes().Any(a => 43return property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute)); 58var attribute = property.GetAttributes().FirstOrDefault(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute)); 87return property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.CascadingParameterAttribute));
Microsoft.AspNetCore.Http.RequestDelegateGenerator (7)
src\Shared\RoslynUtils\SymbolExtensions.cs (4)
54foreach (var attributeData in symbol.GetAttributes()) 76if (current.GetAttributes().Any(attr => 111foreach (var attributeData in symbol.GetAttributes()) 151return symbol.GetAttributes().TryGetAttributeInheritingFrom(baseType, out matchedAttribute);
StaticRouteHandlerModel\EndpointParameter.cs (3)
28ProcessEndpointParameterSource(endpoint, parameter, parameter.GetAttributes(), wellKnownTypes); 40attributeBuilder.AddRange(property.GetAttributes()); 43attributeBuilder.AddRange(parameter.GetAttributes());
Microsoft.AspNetCore.Mvc.Analyzers (3)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (1)
126foreach (var attribute in symbol.GetAttributes())
src\Shared\Roslyn\CodeAnalysisExtensions.cs (2)
23foreach (var declaredAttribute in symbol.GetAttributes()) 133foreach (var declaredAttribute in symbol.GetAttributes())
Microsoft.AspNetCore.Mvc.Api.Analyzers (3)
ActualApiResponseMetadataFactory.cs (1)
280var attributes = symbol.GetAttributes();
src\Shared\Roslyn\CodeAnalysisExtensions.cs (2)
23foreach (var declaredAttribute in symbol.GetAttributes()) 133foreach (var declaredAttribute in symbol.GetAttributes())
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
HubClientProxyGenerator.Parser.cs (1)
160foreach (var attributeData in methodSymbol.GetAttributes())
HubServerProxyGenerator.Parser.cs (1)
150foreach (var attributeData in methodSymbol.GetAttributes())
Microsoft.CodeAnalysis (7)
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
279var attributes = symbol.GetAttributes().Where(a => IsSuppressionAttribute(a)); 315var attributes = symbol.GetAttributes().Where(a => IsSuppressionAttribute(a));
SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithMetadataName.cs (3)
39/// To get the entire list of attributes, use <see cref="ISymbol.GetAttributes"/> on <see cref="TargetSymbol"/>. 155addMatchingAttributes(symbol.GetAttributes()); 161addMatchingAttributes(module.GetAttributes());
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (1)
190foreach (var attribute in typeSymbol.GetAttributes())
Microsoft.CodeAnalysis.Analyzers (39)
ImplementationIsObsoleteAnalyzer.cs (1)
49System.Collections.Generic.IEnumerable<AttributeData> attributes = iface.GetAttributes();
InternalImplementationOnlyAnalyzer.cs (1)
52System.Collections.Generic.IEnumerable<AttributeData> attributes = iface.GetAttributes();
MetaAnalyzers\CompilerExtensionStrictApiAnalyzer.cs (1)
170foreach (var attribute in extension.GetAttributes())
MetaAnalyzers\CompilerExtensionTargetFrameworkAnalyzer.cs (1)
119foreach (var attribute in extension.GetAttributes())
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (3)
57VerifyAttributes(context.ReportDiagnostic, compilationContext.Compilation.Assembly.GetAttributes(), context.CancellationToken); 58VerifyAttributes(context.ReportDiagnostic, compilationContext.Compilation.SourceModule.GetAttributes(), context.CancellationToken); 62context => VerifyAttributes(context.ReportDiagnostic, context.Symbol.GetAttributes(), context.CancellationToken),
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (8)
62method.GetAttributes(), 71CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 88method.GetAttributes(), 115typeParameter.GetAttributes(), 148var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 151.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 164attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg), 167p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (4)
27property.GetAttributes(), 47.Any(static (p, arg) => p.GetAttributes().Any(ShouldRemoveAttribute, arg), arg); 53property.GetAttributes(), 62p.GetAttributes().WhereAsArray(static (a, arg) => !ShouldRemoveAttribute(a, arg), arg: arg),
Microsoft.CodeAnalysis.AnalyzerUtilities (16)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ParameterValidationAnalysis\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (1)
126=> parameter != null && parameter.GetAttributes().Any(attr => attr.AttributeClass != null &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.CodeAnalysis.BannedApiAnalyzers (35)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (8)
62method.GetAttributes(), 71CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 88method.GetAttributes(), 115typeParameter.GetAttributes(), 148var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 151.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 164attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg), 167p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (4)
27property.GetAttributes(), 47.Any(static (p, arg) => p.GetAttributes().Any(ShouldRemoveAttribute, arg), arg); 53property.GetAttributes(), 62p.GetAttributes().WhereAsArray(static (a, arg) => !ShouldRemoveAttribute(a, arg), arg: arg),
SymbolIsBannedAnalyzerBase.cs (3)
57VerifyAttributes(context.ReportDiagnostic, compilationContext.Compilation.Assembly.GetAttributes(), context.CancellationToken); 58VerifyAttributes(context.ReportDiagnostic, compilationContext.Compilation.SourceModule.GetAttributes(), context.CancellationToken); 62context => VerifyAttributes(context.ReportDiagnostic, context.Symbol.GetAttributes(), context.CancellationToken),
Microsoft.CodeAnalysis.CodeStyle (13)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
800foreach (var attribute in symbol.GetAttributes())
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
897foreach (var attribute in symbol.GetAttributes()) 1068=> methodSymbol.GetAttributes().Any(static (a, self) => self._attributeSetForMethodsToIgnore.Contains(a.AttributeClass), this);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
241if (method.GetAttributes().Any(static (a, self) => a.AttributeClass is { } attributeClass && self._attributeSetForMethodsToIgnore.Contains(attributeClass), this))
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
437var attributes = getterField.GetAttributes();
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.CodeAnalysis.CodeStyle.Fixes (18)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
70parameter, parameter.GetAttributes().WhereAsArray(a => a.AttributeClass is null || a.AttributeClass.IsAccessibleWithin(classType)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (8)
62method.GetAttributes(), 71CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 88method.GetAttributes(), 115typeParameter.GetAttributes(), 148var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 151.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 164attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg), 167p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (4)
27property.GetAttributes(), 47.Any(static (p, arg) => p.GetAttributes().Any(ShouldRemoveAttribute, arg), arg); 53property.GetAttributes(), 62p.GetAttributes().WhereAsArray(static (a, arg) => !ShouldRemoveAttribute(a, arg), arg: arg),
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
319var collectionBuilderAttribute = typeToCheck.GetAttributes().FirstOrDefault(attr => 906.GetAttributes()
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
532!member.GetAttributes().Any() &&
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (13)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
57attributeLists: AttributeGenerator.GenerateAttributeLists(constructor.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (1)
68attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (1)
53attributeLists: AttributeGenerator.GenerateAttributeLists(destructor.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (2)
120AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info), 150var attributes = @event.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
100AttributeGenerator.GenerateAttributeLists(field.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
144=> parameter.WithAttributes(parameter.GetAttributes().WhereAsArray(static (a, destination) => FilterAttribute(a, destination), destination)); 226.. AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
265return AttributeGenerator.GenerateAttributeLists(namedType.GetAttributes(), info);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (1)
95attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
121var attributes = parameter.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
149var attributes = property.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (1)
34AttributeGenerator.GenerateAttributeLists(symbol.GetAttributes(), info),
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
Emit\InAttributeModifierTests.cs (1)
53Assert.Empty(m.Parameters[0].GetAttributes());
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (21)
Attributes\AttributeTests.cs (3)
711var attrs = m0.GetAttributes(); 5723var args = info.Symbol.GetAttributes()[0].CommonConstructorArguments; 11067var attrs = d.BaseType.GetAttributes();
Attributes\AttributeTests_CallerInfoAttributes.cs (4)
1944var attributeArguments = namedType.GetAttributes().Single().ConstructorArguments; 1976var attributeArguments = namedType.GetAttributes().Single().ConstructorArguments; 2008var attributeArguments = namedType.GetAttributes().Single().ConstructorArguments; 2041var attributeArguments = namedType.GetAttributes().Single().ConstructorArguments;
Semantics\ExtensionTests.cs (9)
2784Assert.Empty(symbol.GetAttributes()); 2829Assert.Empty(symbol.GetAttributes()); 2862Assert.Empty(symbol.GetAttributes()); 2883AssertEx.SetEqual(["MyAttribute"], symbol.TypeParameters[0].GetAttributes().Select(a => a.ToString())); 2949Assert.Empty(symbol.GetAttributes()); 2970AssertEx.SetEqual(["MyAttribute"], symbol.ExtensionParameter.GetAttributes().Select(a => a.ToString())); 2995Assert.Empty(symbol.GetAttributes()); 3849AssertEx.SetEqual(["MyAttribute"], parameterSymbol.GetAttributes().Select(a => a.ToString())); 3853AssertEx.SetEqual(["MyAttribute"], extensionSymbol.ExtensionParameter.GetAttributes().Select(a => a.ToString()));
Semantics\PrimaryConstructorTests.cs (5)
20796Assert.Equal(1, primaryConstructor.GetAttributes().Length); 20830Assert.Equal(1, primaryConstructor1.GetAttributes().Length); 20874Assert.Equal(1, primaryConstructor1.GetAttributes().Length); 20919Assert.Empty(primaryConstructor1.GetAttributes()); 20971Assert.Equal(0, primaryConstructor1.GetAttributes().Length);
Microsoft.CodeAnalysis.CSharp.Features (8)
ConvertToExtension\ExtensionMethodEqualityComparer.cs (4)
80if (!AttributesMatch(x.GetAttributes(), y.GetAttributes())) 135AttributesMatch(x.FirstParameter.GetAttributes(), y.FirstParameter.GetAttributes()) &&
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
96field.GetAttributes(),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
319var collectionBuilderAttribute = typeToCheck.GetAttributes().FirstOrDefault(attr => 906.GetAttributes()
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
532!member.GetAttributes().Any() &&
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (15)
Semantics\LambdaDiscardParametersTests.cs (1)
395static ImmutableArray<string> getParameterAttributes(IParameterSymbol parameter) => parameter.GetAttributes().SelectAsArray(a => a.ToString());
Semantics\LambdaTests.cs (5)
3635return format(expr, method.GetAttributes(), method.GetReturnTypeAttributes(), method.Parameters.SelectMany(p => p.GetAttributes())); 3893verifyAttributes(symbol.GetAttributes(), "PropAttribute", "ReturnAttribute", "MethodAttribute"); 3895verifyAttributes(symbol.Parameters[0].GetAttributes(), "ParamAttribute", "TypeParamAttribute"); 4089Assert.Equal("System.ObsoleteAttribute", symbol.GetAttributes().Single().ToString());
Semantics\LocalFunctionTests.cs (5)
500var attributes = symbol.GetAttributes().As<CSharpAttributeData>(); 548var attributes = symbol.GetAttributes(); 818var attributes = symbol.GetAttributes(); 850var attrs = paramSymbol.GetAttributes(); 968var attributes = symbol.GetAttributes();
Semantics\SimpleLambdaParametersWithModifiersTests.cs (4)
131symbol.Parameters.Single().GetAttributes().Single().AttributeClass, 167symbol.Parameters.Single().GetAttributes().Single().AttributeClass, 202symbol.Parameters.Single().GetAttributes().Any(a => a.AttributeClass!.Equals( 205symbol.Parameters.Single().GetAttributes().Any(a => a.AttributeClass!.Equals(
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelAPITests.cs (1)
4484var attribute = method.GetAttributes().Single();
Microsoft.CodeAnalysis.CSharp.Workspaces (13)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
57attributeLists: AttributeGenerator.GenerateAttributeLists(constructor.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (1)
68attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (1)
53attributeLists: AttributeGenerator.GenerateAttributeLists(destructor.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (2)
120AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info), 150var attributes = @event.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
100AttributeGenerator.GenerateAttributeLists(field.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
144=> parameter.WithAttributes(parameter.GetAttributes().WhereAsArray(static (a, destination) => FilterAttribute(a, destination), destination)); 226.. AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
265return AttributeGenerator.GenerateAttributeLists(namedType.GetAttributes(), info);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (1)
95attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
121var attributes = parameter.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
149var attributes = property.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (1)
34AttributeGenerator.GenerateAttributeLists(symbol.GetAttributes(), info),
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
CodeGeneration\SyntaxGeneratorTests.cs (3)
258return typeC.GetAttributes().First(); 5276var attribute = symbol.GetAttributes().Single(); 5717var basePropertyAttributeData = basePropertySymbol.GetAttributes().Single();
Microsoft.CodeAnalysis.EditorFeatures (1)
Navigation\AbstractDefinitionLocationService.cs (1)
179var attributes = method.GetAttributes();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
CodeGeneration\CodeGenerationTests.cs (1)
572var attribute = attributeTarget.GetAttributes().Single(attr => Equals(attr.AttributeClass, attributeType));
CodeGeneration\CodeGenerationTests.CSharp.cs (1)
1155var attribute = method.GetAttributes().Single();
Microsoft.CodeAnalysis.Extensions.Package (6)
Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.CodeAnalysis.Features (21)
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (1)
109=> typeSymbol.GetAttributes()
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (1)
74parameters: method.Parameters.SelectAsArray(p => CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type, p.Name)),
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
320var attribute = type.GetAttributes().FirstOrDefault(d => IsDesignerAttribute(d.AttributeClass));
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (4)
4221=> symbol.GetAttributes().Any(static (data, attributeName) => 4843hasAttributeChange = ReportCustomAttributeRudeEdits(diagnosticContext, oldSymbol.GetAttributes(), newSymbol.GetAttributes(), capabilities, cancellationToken); 5446var attributes = type.GetAttributes();
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
492foreach (var attribute in symbol.GetAttributes())
ExtractClass\ExtractClassWithDialogCodeAction.cs (1)
82_selectedType.GetAttributes(),
ExtractInterface\AbstractExtractInterfaceService.cs (1)
399? CodeGenerationSymbolFactory.CreateAccessorSymbol(property.GetMethod, property.GetMethod.GetAttributes())
ExtractMethod\MethodExtractor.CodeGenerator.cs (1)
419parameter.GetAttributes(), parameter.Variance, parameter.Name, [], parameter.NullableAnnotation,
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
443if (parameterType.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, flagsAttributeType)))
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
87=> _symbol.GetAttributes();
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (1)
79useDecompiler = !symbol.ContainingAssembly.GetAttributes().Any(static attribute => attribute.AttributeClass?.Name == nameof(SuppressIldasmAttribute)
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
106foreach (var attribute in assemblySymbol.GetAttributes())
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
800foreach (var attribute in symbol.GetAttributes())
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
897foreach (var attribute in symbol.GetAttributes()) 1068=> methodSymbol.GetAttributes().Any(static (a, self) => self._attributeSetForMethodsToIgnore.Contains(a.AttributeClass), this);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
241if (method.GetAttributes().Any(static (a, self) => a.AttributeClass is { } attributeClass && self._attributeSetForMethodsToIgnore.Contains(attributeClass), this))
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
437var attributes = getterField.GetAttributes();
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
70parameter, parameter.GetAttributes().WhereAsArray(a => a.AttributeClass is null || a.AttributeClass.IsAccessibleWithin(classType)));
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (32)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (8)
62method.GetAttributes(), 71CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 88method.GetAttributes(), 115typeParameter.GetAttributes(), 148var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 151.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 164attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg), 167p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (4)
27property.GetAttributes(), 47.Any(static (p, arg) => p.GetAttributes().Any(ShouldRemoveAttribute, arg), arg); 53property.GetAttributes(), 62p.GetAttributes().WhereAsArray(static (a, arg) => !ShouldRemoveAttribute(a, arg), arg: arg),
Microsoft.CodeAnalysis.PublicApiAnalyzers (16)
DeclarePublicApiAnalyzer.Impl.cs (1)
607foreach (var attribute in current.GetAttributes())
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.CodeAnalysis.ResxSourceGenerator (15)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1360Private Function ISymbol_GetAttributes() As ImmutableArray(Of AttributeData) Implements ISymbol.GetAttributes
Microsoft.CodeAnalysis.Workspaces (29)
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
297foreach (var attr in assembly.GetAttributes().Where(IsInternalsVisibleToAttribute))
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (1)
145foreach (var attribute in returnType.GetAttributes())
Shared\Extensions\ISymbolExtensions.cs (2)
91var attributes = symbol.GetAttributes(); 114attributes = attributes.IsDefault ? symbol.GetAttributes() : attributes;
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (8)
62method.GetAttributes(), 71CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 88method.GetAttributes(), 115typeParameter.GetAttributes(), 148var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 151.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 164attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg), 167p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (4)
27property.GetAttributes(), 47.Any(static (p, arg) => p.GetAttributes().Any(ShouldRemoveAttribute, arg), arg); 53property.GetAttributes(), 62p.GetAttributes().WhereAsArray(static (a, arg) => !ShouldRemoveAttribute(a, arg), arg: arg),
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (4)
VisualStudioMSBuildWorkspaceTests.cs (4)
1884var attrs = sym.GetAttributes(); 1907var attrs = sym.GetAttributes(); 1931var attrs = sym.GetAttributes(); 1954var attrs = sym.GetAttributes();
Microsoft.Extensions.Logging.Generators (4)
LoggerMessageGenerator.Parser.cs (1)
118ImmutableArray<AttributeData> boundAttributes = logMethodSymbol.GetAttributes();
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithMetadataName.cs (3)
41/// To get the entire list of attributes, use <see cref="ISymbol.GetAttributes"/> on <see cref="TargetSymbol"/>. 167addMatchingAttributes(ref result, symbol.GetAttributes()); 173addMatchingAttributes(ref result, module.GetAttributes());
Microsoft.Extensions.Options.SourceGeneration (2)
Parser.cs (1)
350foreach (var attribute in member.GetAttributes().Where(a => a.AttributeClass is not null))
ParserUtilities.cs (1)
21var attrs = symbol.GetAttributes();
Microsoft.Extensions.Validation.ValidationsGenerator (11)
Extensions\ISymbolExtensions.cs (1)
15var displayNameAttribute = property.GetAttributes()
Extensions\ITypeSymbolExtensions.cs (4)
79foreach (var attribute in type.GetAttributes()) 137return parameter.GetAttributes().Any(attr => 151return property.GetAttributes().Any(attr => 170foreach (var attr in property.GetAttributes())
Parsers\ValidationsGenerator.TypesParser.cs (2)
273var attributes = symbol.GetAttributes(); 298foreach (var attribute in symbol.GetAttributes())
src\Shared\RoslynUtils\SymbolExtensions.cs (4)
54foreach (var attributeData in symbol.GetAttributes()) 76if (current.GetAttributes().Any(attr => 111foreach (var attributeData in symbol.GetAttributes()) 151return symbol.GetAttributes().TryGetAttributeInheritingFrom(baseType, out matchedAttribute);
Microsoft.Gen.BuildMetadata (1)
src\Generators\Shared\ParserUtilities.cs (1)
26var attrs = symbol.GetAttributes();
Microsoft.Gen.ComplianceReports (7)
Parser.cs (7)
118foreach (var attribute in ps!.GetAttributes()) 166foreach (var attribute in typeSymbol.GetAttributes()) 172foreach (var attribute in memberType.GetAttributes()) 178foreach (AttributeData attribute in member.GetAttributes()) 207foreach (var a in method.GetAttributes()) 229foreach (var attribute in p.Type.GetAttributes()) 235foreach (AttributeData attribute in p.GetAttributes())
Microsoft.Gen.ContextualOptions (2)
ContextReceiver.cs (1)
49.Where(_ => _.symbol!.GetAttributes().Any(attribute => SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, holder!.OptionsContextAttribute)))
ContextualOptionsGenerator.cs (1)
41.Where(_ => _.symbol!.GetAttributes().Any(attribute => SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, holder!.OptionsContextAttribute)))
Microsoft.Gen.Logging (2)
Parsing\Parser.cs (1)
472.GetAttributes()
src\Generators\Shared\ParserUtilities.cs (1)
26var attrs = symbol.GetAttributes();
Microsoft.Gen.Logging.Unit.Tests (1)
LogParserUtilitiesTests.cs (1)
90.Setup(x => x.GetAttributes())
Microsoft.Gen.MetadataExtractor (9)
src\Generators\Microsoft.Gen.ComplianceReports\Parser.cs (7)
118foreach (var attribute in ps!.GetAttributes()) 166foreach (var attribute in typeSymbol.GetAttributes()) 172foreach (var attribute in memberType.GetAttributes()) 178foreach (AttributeData attribute in member.GetAttributes()) 207foreach (var a in method.GetAttributes()) 229foreach (var attribute in p.Type.GetAttributes()) 235foreach (AttributeData attribute in p.GetAttributes())
src\Generators\Microsoft.Gen.Metrics\Parser.cs (1)
92foreach (var methodAttribute in methodSymbol.GetAttributes())
src\Generators\Shared\ParserUtilities.cs (1)
26var attrs = symbol.GetAttributes();
Microsoft.Gen.Metrics (2)
Parser.cs (1)
92foreach (var methodAttribute in methodSymbol.GetAttributes())
src\Generators\Shared\ParserUtilities.cs (1)
26var attrs = symbol.GetAttributes();
Microsoft.Gen.MetricsReports (2)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (1)
92foreach (var methodAttribute in methodSymbol.GetAttributes())
src\Generators\Shared\ParserUtilities.cs (1)
26var attrs = symbol.GetAttributes();
Microsoft.Interop.ComInterfaceGenerator (29)
Analyzers\AddGeneratedComClassAnalyzer.cs (3)
36if (type.GetAttributes().Any(attr => generatedComClassAttributeType.Equals(attr.AttributeClass, SymbolEqualityComparer.Default))) 49if (iface.GetAttributes().Any(attr => generatedComInterfaceAttributeType.Equals(attr.AttributeClass, SymbolEqualityComparer.Default))) 57&& type.BaseType.GetAttributes().Any(attr => generatedComClassAttributeType.Equals(attr.AttributeClass, SymbolEqualityComparer.Default)))
Analyzers\ComClassGeneratorDiagnosticsAnalyzer.cs (2)
52if (!classToAnalyze.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, generatedComClassAttributeType))) 93if (iface.GetAttributes().FirstOrDefault(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, generatedComInterfaceAttributeType)) is { } generatedComInterfaceAttribute &&
Analyzers\ComHostingDoesNotSupportGeneratedComInterfaceAnalyzer.cs (2)
53if (containingType.GetAttributes().Any(attr => generatedComClassAttribute.Equals(attr.AttributeClass, SymbolEqualityComparer.Default))) 61if (iface.GetAttributes().Any(attr => generatedComInterfaceAttribute.Equals(attr.AttributeClass, SymbolEqualityComparer.Default)))
Analyzers\ComInterfaceGeneratorDiagnosticsAnalyzer.cs (3)
91foreach (AttributeData attr in typeSymbol.GetAttributes()) 273foreach (AttributeData attr in iface.GetAttributes()) 291foreach (AttributeData attr in symbol.GetAttributes())
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (2)
51AttributeData? interfaceTypeAttributeData = type.GetAttributes().FirstOrDefault(a => a.AttributeClass.Equals(interfaceTypeAttribute, SymbolEqualityComparer.Default)); 80AttributeData comImportAttribute = type.GetAttributes().First(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_InteropServices_ComImportAttribute);
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (1)
99var comImportAttribute = await declaringType.GetAttributes().First(attr => attr.AttributeClass.Equals(comImportAttributeType, SymbolEqualityComparer.Default)).ApplicationSyntaxReference.GetSyntaxAsync(ct).ConfigureAwait(false);
Analyzers\GeneratedComInterfaceAttributeAnalyzer.cs (2)
35ImmutableArray<AttributeData> customAttributes = typeSymbol.GetAttributes(); 78foreach (AttributeData attr in symbol.GetAttributes())
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (2)
37sourceGeneratedComRecognizers.Add(type => type.GetAttributes().Any(attr => generatedComClassAttribute.Equals(attr.AttributeClass, SymbolEqualityComparer.Default))); 41sourceGeneratedComRecognizers.Add(type => type.GetAttributes().Any(attr => generatedComInterfaceAttribute.Equals(attr.AttributeClass, SymbolEqualityComparer.Default)));
Analyzers\VtableIndexStubDiagnosticsAnalyzer.cs (2)
57foreach (AttributeData attr in method.GetAttributes()) 135if (!method.ContainingType.GetAttributes().Any(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)))
ComClassInfo.cs (1)
31AttributeData? generatedComInterfaceAttribute = iface.GetAttributes().FirstOrDefault(attr => SymbolEqualityComparer.Default.Equals(attr.AttributeClass, generatedComInterfaceAttributeType));
ComInterfaceGenerator.cs (1)
261foreach (AttributeData attr in symbol.GetAttributes())
ComInterfaceInfo.cs (2)
336foreach (var attr in implemented.GetAttributes()) 370foreach (var attr in interfaceSymbol.GetAttributes())
ComMethodInfo.cs (2)
97new ComMethodInfo(null, method.Name, method.GetAttributes().Select(AttributeInfo.From).ToImmutableArray().ToSequenceEqual(), false), 144var attributes = method.GetAttributes();
GeneratedComInterfaceAttributeData.cs (1)
43foreach (var attr in interfaceSymbol.GetAttributes())
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
245&& !parameter.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute))
VtableIndexStubGenerator.cs (2)
195foreach (AttributeData attr in symbol.GetAttributes()) 285var unmanagedObjectUnwrapper = symbol.ContainingType.GetAttributes().FirstOrDefault(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute));
Microsoft.Interop.JavaScript.JSImportGenerator (3)
Analyzers\JSImportExportDiagnosticsAnalyzer.cs (1)
86foreach (AttributeData attr in method.GetAttributes())
JSExportGenerator.cs (1)
154foreach (AttributeData attr in symbol.GetAttributes())
JSImportGenerator.cs (1)
137foreach (AttributeData attr in symbol.GetAttributes())
Microsoft.Interop.LibraryImportGenerator (11)
Analyzers\ConvertToLibraryImportAnalyzer.cs (4)
121foreach (AttributeData attr in method.GetAttributes()) 142AttributeData dllImportAttribute = method.GetAttributes().First(attr => attr.AttributeClass.ToDisplayString() == TypeNames.DllImportAttribute); 186AttributeData? bestFitMappingContainingType = method.ContainingType.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute); 192AttributeData? bestFitMappingContainingAssembly = method.ContainingAssembly.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute);
Analyzers\ConvertToLibraryImportFixer.cs (1)
662foreach (AttributeData attrLocal in method.GetAttributes())
Analyzers\CustomMarshallerAttributeFixer.cs (1)
182=> (ITypeSymbol)attributedTypeSymbol.GetAttributes().First(attr =>
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (2)
99foreach (AttributeData attr in method.GetAttributes()) 198foreach (AttributeData attr in symbol.GetAttributes())
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
60AttributeData? attrData = containingType.GetAttributes().FirstOrDefault(
LibraryImportGenerator.cs (1)
216foreach (AttributeData attr in symbol.GetAttributes())
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
245&& !parameter.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute))
Microsoft.Interop.LibraryImportGenerator.Downlevel (3)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (2)
101foreach (AttributeData attr in method.GetAttributes()) 196foreach (AttributeData attr in symbol.GetAttributes())
DownlevelLibraryImportGenerator.cs (1)
159foreach (AttributeData attr in symbol.GetAttributes())
Microsoft.Interop.SourceGeneration (14)
CompilationExtensions.cs (2)
17if (compilation.SourceModule.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_CompilerServices_SkipLocalsInitAttribute)) 21if (compilation.Assembly.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_CompilerServices_DisableRuntimeMarshallingAttribute))
ManualTypeMarshallingHelper.cs (3)
86&& entryPointType.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.ContiguousCollectionMarshallerAttribute); 91return entryPointType.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.CustomMarshallerAttribute); 155var attrs = entryPointType.GetAttributes().Where(attr => attr.AttributeClass.ToDisplayString() == TypeNames.CustomMarshallerAttribute).ToArray();
MarshallingInfoParser.cs (1)
242if (GetMarshallingInfoForAttributes(type.GetAttributes().AsSpan(), type, indirectionDepth, useSiteAttributes, GetMarshallingInfo) is MarshallingInfo info)
MethodSignatureElementInfoProvider.cs (2)
49marshallingInfoCallback(param.Type, new UseSiteAttributeProvider(_useSiteAttributeParsers, param.GetAttributes(), rootProvider, _generatorDiagnostics, marshallingInfoCallback), 0), _compilation) with 71marshallingInfoCallback(param.Type, new UseSiteAttributeProvider(_useSiteAttributeParsers, param.GetAttributes(), rootProvider, _generatorDiagnostics, marshallingInfoCallback), 0), _compilation) with
SignatureContext.cs (3)
112MarshallingInfo marshallingInfo = marshallingInfoParser.ParseMarshallingInfo(param.Type, param.GetAttributes()); 156if (method.GetAttributes().Any(IsSkipLocalsInitAttribute)) 163if (type.GetAttributes().Any(IsSkipLocalsInitAttribute))
TypePositionInfo.cs (1)
90var (byValueContentsMarshalKind, inLocation, outLocation) = GetByValueContentsMarshalKind(paramSymbol.GetAttributes(), compilation);
TypeSymbolExtensions.cs (2)
120foreach (AttributeData attr in type.GetAttributes()) 137foreach (AttributeData attr in type.GetAttributes())
Microsoft.Maui.Controls.BindingSourceGen (1)
ISymbolExtensions.cs (1)
53 return symbol.GetAttributes().FirstOrDefault(attr => attr.AttributeClass?.Name == attributeName);
Microsoft.Maui.Controls.SourceGen (1)
CodeBehindGenerator.cs (1)
212 foreach (var attr in symbol.GetAttributes())
Microsoft.ML.InternalCodeAnalyzer (6)
BestFriendAnalyzer.cs (2)
99assemblyWantsBestFriends = symbolAssembly.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, wantsToBeBestFriendsAttributeType)); 104if (symbol.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, bestFriendAttributeType)))
BestFriendOnPublicDeclarationsAnalyzer.cs (1)
62var attribute = context.Symbol.GetAttributes().FirstOrDefault(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, attributeType));
ContractsCheckNameofFixProvider.cs (1)
143AttributeData attr = s.GetAttributes().FirstOrDefault(a => a.AttributeClass.Name == "ArgumentAttribute");
IMethodSymbolExtensions.cs (1)
14foreach (var attribute in method.GetAttributes())
InstanceInitializerAnalyzer.cs (1)
49if (symbol.GetAttributes().Any(i => i.AttributeClass.Name == "ArgumentAttribute"))
Mvc.Api.Analyzers.Test (3)
ActualApiResponseMetadataFactoryTest.cs (2)
28var attribute = compilation.GetTypeByMetadataName(typeof(TestActionResultUsingStatusCodesConstants).FullName).GetAttributes()[0]; 42var attribute = compilation.GetTypeByMetadataName(typeof(TestActionResultUsingHttpStatusCodeCast).FullName).GetAttributes()[0];
SymbolApiResponseMetadataProviderTest.cs (1)
393var attribute = method.GetAttributes().First();
Roslyn.Diagnostics.Analyzers (42)
AbstractApplyTraitToClass`1.cs (2)
85var expectedAttributeData = state.SemanticModel.GetDeclaredSymbol(method, cancellationToken)!.GetAttributes() 105var actualAttributeData = state.SemanticModel.GetDeclaredSymbol(originalNode, cancellationToken)!.GetAttributes()
AbstractDoNotCopyValue.cs (1)
1709foreach (var attribute in symbol.GetAttributes())
AbstractRunIterations`1.cs (1)
58foreach (var attribute in methodSymbol.GetAttributes())
DoNotMixAttributesFromDifferentVersionsOfMEF.cs (2)
93foreach (var attribute in member.GetAttributes()) 107foreach (var attribute in parameter.GetAttributes())
ExportedPartsShouldHaveImportingConstructor.cs (1)
118var constructorAttributes = constructor.GetAttributes();
ExportedPartsShouldHaveImportingConstructorCodeFixProvider.cs (1)
180foreach (var attributeData in exportedType.GetAttributes())
ImportingConstructorShouldBeObsolete.cs (1)
94var constructorAttributes = constructor.GetAttributes();
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (8)
62method.GetAttributes(), 71CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 88method.GetAttributes(), 115typeParameter.GetAttributes(), 148var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 151.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 164attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg), 167p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (4)
27property.GetAttributes(), 47.Any(static (p, arg) => p.GetAttributes().Any(ShouldRemoveAttribute, arg), arg); 53property.GetAttributes(), 62p.GetAttributes().WhereAsArray(static (a, arg) => !ShouldRemoveAttribute(a, arg), arg: arg),
TestExportsShouldNotBeDiscoverableCodeFixProvider.cs (1)
72foreach (var attributeData in exportedType.GetAttributes())
Roslyn.Diagnostics.CSharp.Analyzers (13)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
57attributeLists: AttributeGenerator.GenerateAttributeLists(constructor.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (1)
68attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (1)
53attributeLists: AttributeGenerator.GenerateAttributeLists(destructor.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (2)
120AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info), 150var attributes = @event.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
100AttributeGenerator.GenerateAttributeLists(field.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
144=> parameter.WithAttributes(parameter.GetAttributes().WhereAsArray(static (a, destination) => FilterAttribute(a, destination), destination)); 226.. AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
265return AttributeGenerator.GenerateAttributeLists(namedType.GetAttributes(), info);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (1)
95attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
121var attributes = parameter.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
149var attributes = property.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (1)
34AttributeGenerator.GenerateAttributeLists(symbol.GetAttributes(), info),
System.Private.CoreLib.Generators (3)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (3)
169foreach (var attributeData in methodSymbol.GetAttributes()) 384foreach (var attributeData in symbol.GetAttributes()) 517foreach (var attributeData in symbolThatMightHaveCompExactlyDependsOnAttribute.GetAttributes())
System.Text.Json.SourceGeneration (6)
Helpers\RoslynExtensions.cs (2)
120=> attributeType != null && memberInfo.GetAttributes().Any(attr => SymbolEqualityComparer.Default.Equals(attr.AttributeClass, attributeType)); 379return symbol.GetAttributes().Any(attr =>
JsonSourceGenerator.Parser.cs (4)
249foreach (AttributeData attributeData in contextClassSymbol.GetAttributes()) 289foreach (AttributeData attributeData in contextTypeSymbol.GetAttributes()) 762foreach (AttributeData attributeData in typeToGenerate.Type.GetAttributes()) 1347foreach (AttributeData attributeData in memberInfo.GetAttributes())
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
74if (propertySymbol.GetAttributes()
System.Windows.Forms.PrivateSourceGenerators (1)
System\Windows\Forms\SourceGenerators\EnumValidationGenerator.cs (1)
226bool isFlags = enumType.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, flagsAttributeType));
Test.Utilities (13)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Text.Analyzers (32)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
571var attributeUsageAttribute = attributeType.GetAttributes() 847if (symbol.GetAttributes().Any(static x => x.AttributeClass is 854if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 875return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
716foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 801namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (8)
62method.GetAttributes(), 71CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 88method.GetAttributes(), 115typeParameter.GetAttributes(), 148var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 151.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 164attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg), 167p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg: arg),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (4)
27property.GetAttributes(), 47.Any(static (p, arg) => p.GetAttributes().Any(ShouldRemoveAttribute, arg), arg); 53property.GetAttributes(), 62p.GetAttributes().WhereAsArray(static (a, arg) => !ShouldRemoveAttribute(a, arg), arg: arg),