13 implementations of GetAttributes
Analyzer.Utilities.UnitTests (1)
Lightup\LightupHelpersTests.cs (1)
138ImmutableArray<AttributeData> ISymbol.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)
1347Private 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()
627 references to GetAttributes
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
103var attrData = parameter.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));
GenerateDocumentationAndConfigFiles (28)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43foreach (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)
443var assemblyMetadata = refAssembly.GetAttributes().FirstOrDefault(attr =>
Metrics (13)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Metrics.Legacy (13)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.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 (37)
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)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43foreach (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 (14)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.CodeAnalysis.BannedApiAnalyzers (33)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43foreach (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 (11)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
800foreach (var attribute in symbol.GetAttributes())
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
774foreach (var attribute in symbol.GetAttributes()) 929=> 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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.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)
43foreach (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)
337if (namedType.GetAttributes().Any(a => a.AttributeClass.IsCollectionBuilderAttribute())) 893.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)); 229attributes.AddRange(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)
51Assert.Empty(m.Parameters[0].GetAttributes());
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (15)
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 (3)
2795AssertEx.SetEqual(["System.ObsoleteAttribute"], symbol.GetAttributes().Select(a => a.ToString())); 3579AssertEx.SetEqual(["MyAttribute"], parameterSymbol.GetAttributes().Select(a => a.ToString())); 3583AssertEx.SetEqual(["MyAttribute"], extensionSymbol.ExtensionParameter.GetAttributes().Select(a => a.ToString()));
Semantics\PrimaryConstructorTests.cs (5)
20656Assert.Equal(1, primaryConstructor.GetAttributes().Length); 20690Assert.Equal(1, primaryConstructor1.GetAttributes().Length); 20734Assert.Equal(1, primaryConstructor1.GetAttributes().Length); 20779Assert.Empty(primaryConstructor1.GetAttributes()); 20831Assert.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)
337if (namedType.GetAttributes().Any(a => a.AttributeClass.IsCollectionBuilderAttribute())) 893.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)
3638return format(expr, method.GetAttributes(), method.GetReturnTypeAttributes(), method.Parameters.SelectMany(p => p.GetAttributes())); 3896verifyAttributes(symbol.GetAttributes(), "PropAttribute", "ReturnAttribute", "MethodAttribute"); 3898verifyAttributes(symbol.Parameters[0].GetAttributes(), "ParamAttribute", "TypeParamAttribute"); 4094Assert.Equal("System.ObsoleteAttribute", symbol.GetAttributes().Single().ToString());
Semantics\LocalFunctionTests.cs (5)
506var attributes = symbol.GetAttributes().As<CSharpAttributeData>(); 554var attributes = symbol.GetAttributes(); 824var attributes = symbol.GetAttributes(); 856var attrs = paramSymbol.GetAttributes(); 974var 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)); 229attributes.AddRange(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 (2)
CodeGeneration\SyntaxGeneratorTests.cs (2)
256return typeC.GetAttributes().First(); 5274var attribute = symbol.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 (5)
Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.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)
4170=> symbol.GetAttributes().Any(static (data, attributeName) => 4792hasAttributeChange = ReportCustomAttributeRudeEdits(diagnosticContext, oldSymbol.GetAttributes(), newSymbol.GetAttributes(), capabilities, cancellationToken); 5395var attributes = type.GetAttributes();
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
485foreach (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)
774foreach (var attribute in symbol.GetAttributes()) 929=> 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 (30)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43foreach (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 (14)
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)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.CodeAnalysis.ResxSourceGenerator (13)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1347Private Function ISymbol_GetAttributes() As ImmutableArray(Of AttributeData) Implements ISymbol.GetAttributes
Microsoft.CodeAnalysis.Workspaces (26)
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
287foreach (var attr in assembly.GetAttributes().Where(IsInternalsVisibleToAttribute))
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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43foreach (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)
1890var attrs = sym.GetAttributes(); 1913var attrs = sym.GetAttributes(); 1937var attrs = sym.GetAttributes(); 1960var attrs = sym.GetAttributes();
Microsoft.Extensions.Logging.Generators (4)
LoggerMessageGenerator.Parser.cs (1)
120ImmutableArray<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 => 164return property.GetAttributes().Any(attr =>
Parsers\ValidationsGenerator.TypesParser.cs (2)
268var attributes = symbol.GetAttributes(); 293foreach (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.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)
91foreach (var methodAttribute in methodSymbol.GetAttributes())
src\Generators\Shared\ParserUtilities.cs (1)
26var attrs = symbol.GetAttributes();
Microsoft.Gen.Metrics (2)
Parser.cs (1)
91foreach (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)
91foreach (var methodAttribute in methodSymbol.GetAttributes())
src\Generators\Shared\ParserUtilities.cs (1)
26var attrs = symbol.GetAttributes();
Microsoft.Interop.ComInterfaceGenerator (23)
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\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\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (2)
51AttributeData? interfaceTypeAttributeData = type.GetAttributes().FirstOrDefault(a => a.AttributeClass.Equals(interfaceTypeAttribute, SymbolEqualityComparer.Default)); 76AttributeData 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)));
ComClassInfo.cs (1)
45AttributeData? generatedComInterfaceAttribute = iface.GetAttributes().FirstOrDefault(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute);
ComInterfaceGenerator.cs (1)
282foreach (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 (3)
210foreach (AttributeData attr in symbol.GetAttributes()) 300var unmanagedObjectUnwrapper = symbol.ContainingType.GetAttributes().FirstOrDefault(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)); 419if (!method.ContainingType.GetAttributes().Any(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)))
Microsoft.Interop.JavaScript.JSImportGenerator (2)
JSExportGenerator.cs (1)
178foreach (AttributeData attr in symbol.GetAttributes())
JSImportGenerator.cs (1)
161foreach (AttributeData attr in symbol.GetAttributes())
Microsoft.Interop.LibraryImportGenerator (9)
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\ShapeBreakingDiagnosticSuppressor.cs (1)
60AttributeData? attrData = containingType.GetAttributes().FirstOrDefault(
LibraryImportGenerator.cs (1)
238foreach (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 (1)
DownlevelLibraryImportGenerator.cs (1)
173foreach (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.SourceModule.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)
242foreach (AttributeData typeAttribute in type.GetAttributes())
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 (40)
AbstractApplyTraitToClass`1.cs (2)
85var expectedAttributeData = state.SemanticModel.GetDeclaredSymbol(method, cancellationToken)!.GetAttributes() 105var actualAttributeData = state.SemanticModel.GetDeclaredSymbol(originalNode, cancellationToken)!.GetAttributes()
AbstractDoNotCopyValue.cs (1)
1710foreach (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)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43foreach (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)); 229attributes.AddRange(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 (4)
EventSourceGenerator.Parser.cs (1)
35foreach (AttributeData attribute in context.TargetSymbol.GetAttributes())
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 (5)
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 (3)
240foreach (AttributeData attributeData in contextClassSymbol.GetAttributes()) 705foreach (AttributeData attributeData in typeToGenerate.Type.GetAttributes()) 1260foreach (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 (11)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Text.Analyzers (30)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
221var attributes = symbol.GetAttributes(); 393|| namedType.GetAttributes().Any((a) =>
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
546foreach (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\Extensions\Symbols\ISymbolExtensions.cs (3)
814if (symbol.GetAttributes().Any(static x => x.AttributeClass is 821if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 842return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (2)
709foreach (var attributeData in type.ContainingAssembly.GetAttributes()) 794namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43foreach (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),