8 implementations of GetAttributes
GenerateDocumentationAndConfigFiles (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
164public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
164public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
164public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.CSharp (2)
Symbols\PublicModel\PreprocessingSymbol.cs (1)
64ImmutableArray<AttributeData> ISymbol.GetAttributes() => ImmutableArray<AttributeData>.Empty;
Symbols\PublicModel\Symbol.cs (1)
121ImmutableArray<AttributeData> ISymbol.GetAttributes()
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
88public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.Workspaces (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
164public ImmutableArray<AttributeData> GetAttributes()
Roslyn.Diagnostics.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
164public ImmutableArray<AttributeData> GetAttributes()
579 references to GetAttributes
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
107var attrData = parameter.GetAttributes()
Aspire.Hosting.Azure.Provisioning.Tests (4)
AspireProvisioningProxyGeneratorTests.cs (4)
94.Where(static method => method.GetAttributes().Any(static attribute => 102.Where(static property => property.GetAttributes().Any(static attribute => 456.Where(static member => member.GetAttributes().Any(static attribute => 499var experimental = Assert.Single(symbol.GetAttributes(), static attribute =>
Aspire.Hosting.Integration.Analyzers (17)
AspireExportAnalyzer.cs (17)
234return assembly.GetAttributes().Any(static attribute => 235attribute.AttributeClass?.GetAttributes().Any(static providerAttribute => 257foreach (var attr in method.GetAttributes()) 277foreach (var attr in method.ContainingType.GetAttributes()) 407AnalyzeUnionAttribute(context, parameter.GetAttributes(), aspireUnionAttribute, wellKnownTypes, aspireExportAttribute, currentAssemblyExportedTypes); 501foreach (var attribute in context.Compilation.Assembly.GetAttributes()) 551foreach (var attribute in assembly.GetAttributes()) 570foreach (var attribute in compilation.Assembly.GetAttributes()) 936foreach (var attr in contextNamedType.GetAttributes()) 1903foreach (var attr in symbol.GetAttributes()) 1921foreach (var attr in symbol.GetAttributes()) 2068foreach (var attr in method.GetAttributes()) 2097foreach (var attr in type.GetAttributes()) 2429foreach (var attr in type.GetAttributes()) 2448foreach (var attr in containingAssembly.GetAttributes()) 2469foreach (var attr in assembly.GetAttributes()) 2512foreach (var attr in type.GetAttributes())
ConfigurationSchemaGenerator (3)
ConfigSchemaEmitter.cs (1)
412var attributes = propertySymbol?.GetAttributes();
ConfigSchemaGenerator.cs (1)
63foreach (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\roslyn\src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
577var attributeUsageAttribute = currentType.GetAttributes() 857if (symbol.GetAttributes().Any(static x => x.AttributeClass is 864if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 885return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\roslyn\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)
433var assemblyMetadata = refAssembly.GetAttributes().FirstOrDefault(attr =>
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\aspnetcore\src\Shared\Roslyn\CodeAnalysisExtensions.cs (2)
23foreach (var declaredAttribute in symbol.GetAttributes()) 133foreach (var declaredAttribute in symbol.GetAttributes())
src\aspnetcore\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.AI.SourceGenerators (2)
ToolBlockParser.cs (2)
77foreach (var attr in classSymbol.GetAttributes()) 212foreach (var attr in prop.GetAttributes())
Microsoft.AspNetCore.Components.Analyzers (7)
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));
JSInvokableAnalyzer.cs (1)
37var attributes = method.GetAttributes();
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\aspnetcore\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\aspnetcore\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.Build.TaskAuthoring.Analyzer (5)
MultiThreadableTaskDeclarationAnalyzer.cs (1)
136foreach (AttributeData attribute in type.GetAttributes())
PreferTypedParameterAnalyzer.cs (2)
304namedType.GetAttributes().Any( 340if (outputAttributeType is not null && member.GetAttributes().Any(
RequiredTaskPropertyInitializationSuppressor.cs (1)
124foreach (AttributeData attribute in property.GetAttributes())
SharedAnalyzerHelpers.cs (1)
59foreach (AttributeData attribute in type.GetAttributes())
Microsoft.CodeAnalysis (8)
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
308var attributes = symbol.GetAttributes().Where(a => IsSuppressionAttribute(a)); 344var attributes = symbol.GetAttributes().Where(a => IsSuppressionAttribute(a));
SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithMetadataName.cs (4)
39/// To get the entire list of attributes, use <see cref="ISymbol.GetAttributes"/> on <see cref="TargetSymbol"/>. 155addMatchingAttributes(symbol.GetAttributes()); 164addMatchingAttributes(module.GetAttributes()); 199addMatchingAttributes(constructorSymbol.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\roslyn\src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (3)
65VerifyAttributes(context.ReportDiagnostic, compilationContext.Compilation.Assembly.GetAttributes(), context.CancellationToken); 66VerifyAttributes(context.ReportDiagnostic, compilationContext.Compilation.SourceModule.GetAttributes(), context.CancellationToken); 72VerifyAttributes(context.ReportDiagnostic, context.Symbol.GetAttributes(), context.CancellationToken);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
577var attributeUsageAttribute = currentType.GetAttributes() 857if (symbol.GetAttributes().Any(static x => x.AttributeClass is 864if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 885return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\roslyn\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\683181b2796de991\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (1)
126=> parameter != null && parameter.GetAttributes().Any(attr => attr.AttributeClass != null &&
src\roslyn\src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
577var attributeUsageAttribute = currentType.GetAttributes() 857if (symbol.GetAttributes().Any(static x => x.AttributeClass is 864if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 885return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\roslyn\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 (13)
src\9547feb31df4cc5d\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
241if (method.GetAttributes().Any(static (a, self) => a.AttributeClass is { } attributeClass && self._attributeSetForMethodsToIgnore.Contains(attributeClass), this))
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
800foreach (var attribute in symbol.GetAttributes())
src\roslyn\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\roslyn\src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
437var attributes = getterField.GetAttributes();
src\roslyn\src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
577var attributeUsageAttribute = currentType.GetAttributes() 857if (symbol.GetAttributes().Any(static x => x.AttributeClass is 864if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 885return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\roslyn\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\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
70parameter, parameter.GetAttributes().WhereAsArray(a => a.AttributeClass is null || a.AttributeClass.IsAccessibleWithin(classType)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\roslyn\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\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
319var collectionBuilderAttribute = typeToCheck.GetAttributes().FirstOrDefault(attr => 906.GetAttributes()
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
532!member.GetAttributes().Any() &&
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (13)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
57attributeLists: AttributeGenerator.GenerateAttributeLists(constructor.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (1)
68attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (1)
53attributeLists: AttributeGenerator.GenerateAttributeLists(destructor.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (2)
120AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info), 150var attributes = @event.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
100AttributeGenerator.GenerateAttributeLists(field.GetAttributes(), info),
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
265return AttributeGenerator.GenerateAttributeLists(namedType.GetAttributes(), info);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (1)
95attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
121var attributes = parameter.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
149var attributes = property.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (1)
34AttributeGenerator.GenerateAttributeLists(symbol.GetAttributes(), info),
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\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
319var collectionBuilderAttribute = typeToCheck.GetAttributes().FirstOrDefault(attr => 906.GetAttributes()
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
532!member.GetAttributes().Any() &&
Microsoft.CodeAnalysis.CSharp.Workspaces (13)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
57attributeLists: AttributeGenerator.GenerateAttributeLists(constructor.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (1)
68attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (1)
53attributeLists: AttributeGenerator.GenerateAttributeLists(destructor.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (2)
120AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info), 150var attributes = @event.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
100AttributeGenerator.GenerateAttributeLists(field.GetAttributes(), info),
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
265return AttributeGenerator.GenerateAttributeLists(namedType.GetAttributes(), info);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (1)
95attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
121var attributes = parameter.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
149var attributes = property.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (1)
34AttributeGenerator.GenerateAttributeLists(symbol.GetAttributes(), info),
Microsoft.CodeAnalysis.Extensions.Package (6)
Symbols\ISymbolExtensions.cs (4)
577var attributeUsageAttribute = currentType.GetAttributes() 857if (symbol.GetAttributes().Any(static x => x.AttributeClass is 864if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 885return 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 (22)
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)
4226=> symbol.GetAttributes().Any(static (data, attributeName) => 4848hasAttributeChange = ReportCustomAttributeRudeEdits(diagnosticContext, oldSymbol.GetAttributes(), newSymbol.GetAttributes(), capabilities, cancellationToken); 5451var attributes = type.GetAttributes();
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
492foreach (var attribute in symbol.GetAttributes())
ExtractClass\ExtractClassWithDialogCodeAction.cs (1)
85_selectedType.GetAttributes(),
ExtractInterface\AbstractExtractInterfaceService.cs (1)
402? 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)
89=> _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\9547feb31df4cc5d\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
241if (method.GetAttributes().Any(static (a, self) => a.AttributeClass is { } attributeClass && self._attributeSetForMethodsToIgnore.Contains(attributeClass), this))
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
800foreach (var attribute in symbol.GetAttributes())
src\roslyn\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\roslyn\src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
437var attributes = getterField.GetAttributes();
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
70parameter, parameter.GetAttributes().WhereAsArray(a => a.AttributeClass is null || a.AttributeClass.IsAccessibleWithin(classType)));
Testing\AbstractTestMethodFinder.cs (1)
147foreach (var attribute in methodSymbol.GetAttributes())
Microsoft.CodeAnalysis.NetAnalyzers (31)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\MarkAssembliesWithAttributesDiagnosticAnalyzer.cs (1)
72foreach (AttributeData attribute in context.Compilation.Assembly.GetAttributes())
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidUninstantiatedInternalClasses.cs (1)
113var typeAttributes = type.GetAttributes();
Microsoft.CodeQuality.Analyzers\QualityGuidelines\DoNotInitializeUnnecessarily.cs (2)
51|| !field.GetAttributes().IsEmpty) // in case of attributes that impact nullability analysis 74|| !prop.GetAttributes().IsEmpty) // in case of attributes that impact nullability analysis
Microsoft.CodeQuality.Analyzers\QualityGuidelines\MarkMembersAsStatic.cs (2)
288var attributes = methodSymbol.GetAttributes(); 292attributes = attributes.AddRange(methodSymbol.AssociatedSymbol.GetAttributes());
Microsoft.NetCore.Analyzers\InteropServices\PlatformCompatibilityAnalyzer.cs (3)
241foreach (AttributeData attribute in method.GetAttributes()) 1455foreach (AttributeData attribute in symbol.GetAttributes()) 1833MergePlatformAttributes(symbol.GetAttributes(), ref attributes, crossPlatform, relatedPlatforms);
Microsoft.NetCore.Analyzers\InteropServices\PlatformCompatibilityAnalyzer.OperationVisitor.cs (2)
45var attributes = symbol.GetAttributes(); 202var attributes = method.GetAttributes();
Microsoft.NetCore.Analyzers\Runtime\AttributeStringLiteralsShouldParseCorrectly.cs (1)
145var attributes = symbol.GetAttributes();
Microsoft.NetCore.Analyzers\Runtime\DoNotPassLiteralsAsLocalizedParameters.cs (1)
303LocalizableAttributeState localizedState = GetLocalizableAttributeStateCore(symbol.GetAttributes(), localizableAttributeTypeSymbol);
Microsoft.NetCore.Analyzers\Runtime\PreferReadOnlySpanPropertiesOverReadOnlyArrayFieldsAnalyzer.cs (2)
263foreach (var attribute in field.GetAttributes()) 281foreach (var usage in type.GetAttributes())
Microsoft.NetCore.Analyzers\Runtime\ProvideCorrectArgumentsToFormattingMethods.cs (1)
496foreach (AttributeData attribute in parameters[i].GetAttributes())
Microsoft.NetCore.Analyzers\Security\UseAutoValidateAntiforgeryToken.cs (2)
317else if (!actionMethodSymbol.GetAttributes().Any(s => s.AttributeClass?.GetBaseTypes().Contains(httpMethodAttributeTypeSymbol) == true)) 418if (symbol.GetAttributes().Any(s => s.AttributeClass != null && s_AntiForgeryAttributeRegex.IsMatch(s.AttributeClass.Name)))
Microsoft.NetFramework.Analyzers\MarkVerbHandlersWithValidateAntiforgeryTokenAnalyzer.cs (1)
116ImmutableArray<AttributeData> methodAttributes = methodSymbol.GetAttributes();
src\47c588c5b8785708\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (1)
124=> parameter != null && parameter.GetAttributes().Any(attr => attr.AttributeClass != null &&
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
219var attributes = symbol.GetAttributes(); 391|| namedType.GetAttributes().Any(static (a, wellKnownTypeProvider) =>
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
719foreach (var attribute in method.GetAttributes())
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\ISymbolExtensions.cs (5)
637foreach (var attribute in symbol.GetAttributes()) 661foreach (var attribute in symbol.GetAttributes()) 672foreach (var attribute in symbol.GetAttributes()) 716foreach (var actualAttribute in symbol.GetAttributes()) 813foreach (var attributeData in symbol.GetAttributes())
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
182var current = type.GetAttributes(); 213foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 249var current = type.GetAttributes();
Microsoft.CodeAnalysis.Razor.Compiler (19)
Analyzers\ComponentParameterNullableWarningSuppressor.cs (1)
63foreach (var attribute in symbol.GetAttributes())
CSharp\DefaultTagHelperDescriptorFactory.cs (2)
77foreach (var attribute in type.GetAttributes()) 426foreach (var attribute in property.GetAttributes())
CSharp\SymbolExtensions.cs (2)
43=> TryGetAttribute(symbol.GetAttributes(), fullName, out result); 52=> GetAttribute(symbol.GetAttributes(), fullName);
Language\SymbolCache.NamedTypeSymbolData.IsViewComponentResult.cs (1)
55foreach (var attribute in currentType.GetAttributes())
Language\TagHelpers\Producers\AcceptsAssetPathTagHelperProducer.cs (1)
42foreach (var attribute in type.GetAttributes())
Language\TagHelpers\Producers\BindTagHelperProducer.cs (1)
127foreach (var attribute in type.GetAttributes())
Language\TagHelpers\Producers\ComponentTagHelperProducer.cs (7)
157foreach (var attribute in type.GetAttributes()) 243var parameterAttribute = property.GetAttributes().FirstOrDefault( 274pb.IsEditorRequired = property.GetAttributes().Any( 341if (current.GetAttributes().Any(static a => a.HasFullName(ComponentsApi.AssetPathAttribute.MetadataName))) 554foreach (var attribute in typeParameter.GetAttributes()) 776if (!property.GetAttributes().Any(static a => a.HasFullName(ComponentsApi.ParameterAttribute.MetadataName))) 838var attributes = type.GetAttributes();
Language\TagHelpers\Producers\EventHandlerTagHelperProducer.cs (1)
37foreach (var attribute in type.GetAttributes())
Mvc.Version1_X\ViewComponentTagHelperDescriptorFactory.cs (1)
241var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
Mvc.Version2_X\ViewComponentTagHelperDescriptorFactory.cs (1)
256var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
Mvc\ViewComponentTagHelperDescriptorFactory.cs (1)
259var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
Microsoft.CodeAnalysis.ResxSourceGenerator (15)
src\roslyn\src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
577var attributeUsageAttribute = currentType.GetAttributes() 857if (symbol.GetAttributes().Any(static x => x.AttributeClass is 864if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 885return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\roslyn\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.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\roslyn\src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
577var attributeUsageAttribute = currentType.GetAttributes() 857if (symbol.GetAttributes().Any(static x => x.AttributeClass is 864if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 885return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\roslyn\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.Diagnostics.DataContractReader.DataGenerator (3)
Parser.cs (3)
40AttributeData? cdacAttr = classSymbol.GetAttributes() 187foreach (AttributeData a in prop.GetAttributes()) 360AttributeData? a = method.GetAttributes()
Microsoft.DotNet.ApiCompatibility (11)
ApiStabilityClassifier.cs (1)
55foreach (AttributeData attribute in symbol.GetAttributes())
Rules\AttributesMustMatch.cs (10)
229leftNamed.TypeParameters[i].GetAttributes(), 230rightNamed.TypeParameters[i].GetAttributes(), 241left.GetAttributes(), 242right.GetAttributes(), 282leftMethod.Parameters[i].GetAttributes(), 283rightMethod.Parameters[i].GetAttributes(), 298leftMethod.TypeParameters[i].GetAttributes(), 299rightMethod.TypeParameters[i].GetAttributes(), 310left.GetAttributes(), 311right.GetAttributes(),
Microsoft.DotNet.ApiSymbolExtensions (2)
Filtering\ImplicitSymbolFilter.cs (1)
52type.GetAttributes().Any(a => a.AttributeClass?.Name == "EmbeddedAttribute" && a.AttributeClass?.ContainingNamespace.ToDisplayString() == "Microsoft.CodeAnalysis")))
SymbolExtensions.cs (1)
66return symbol.GetAttributes().Any(attribute =>
Microsoft.Extensions.Configuration.Binder.SourceGeneration (1)
ConfigurationBindingGenerator.Parser.cs (1)
757ImmutableArray<AttributeData> attributes = property.GetAttributes();
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
118ImmutableArray<AttributeData> boundAttributes = logMethodSymbol.GetAttributes();
Microsoft.Extensions.Options.SourceGeneration (2)
Parser.cs (1)
464foreach (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 (2)
24var displayAttr = symbol.GetAttributes().FirstOrDefault(a => 59var displayNameAttr = symbol.GetAttributes().FirstOrDefault(a =>
Extensions\ITypeSymbolExtensions.cs (4)
117foreach (var attribute in type.GetAttributes()) 175return parameter.GetAttributes().Any(attr => 189return property.GetAttributes().Any(attr => 208foreach (var attr in property.GetAttributes())
Parsers\ValidationsGenerator.TypesParser.cs (1)
352foreach (var attribute in symbol.GetAttributes())
src\aspnetcore\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)
531.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 (37)
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\AddGeneratedComClassFixer.cs (1)
50var comVisibleAttributes = declaringType.GetAttributes().Where(attr =>
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)
95foreach (AttributeData attr in typeSymbol.GetAttributes()) 277foreach (AttributeData attr in iface.GetAttributes()) 295foreach (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)
103var 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)
36AttributeData? generatedComInterfaceAttribute = iface.GetAttributes().FirstOrDefault(attr => SymbolEqualityComparer.Default.Equals(attr.AttributeClass, generatedComInterfaceAttributeType));
ComInterfaceGenerator.cs (1)
193foreach (AttributeData attr in symbol.GetAttributes())
ComInterfaceInfo.cs (2)
347foreach (var attr in implemented.GetAttributes()) 381foreach (var attr in interfaceSymbol.GetAttributes())
ComMethodInfo.cs (9)
160new ComMethodInfo(null, method.Name, CreateAttributeInfoArray(method.GetAttributes()), false) 218var attributeInfos = CreateAttributeInfoArray(method.GetAttributes()); 335CreateAttributeInfoArray(accessor.GetAttributes()), 360CreateAttributeInfoArray(accessor.GetAttributes()), 373return CreateAttributeInfoArray(property.GetAttributes()); 551&& !IsMarshalUsingComplete(setter.Parameters[setter.Parameters.Length - 1].GetAttributes())) 578foreach (var attribute in method.GetAttributes()) 590foreach (var attribute in parameter.GetAttributes()) 602foreach (var attribute in property.GetAttributes())
GeneratedComInterfaceAttributeData.cs (1)
43foreach (var attr in interfaceSymbol.GetAttributes())
parent\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
241&& !parameter.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute))
VtableIndexStubGenerator.cs (2)
292foreach (AttributeData attr in symbol.GetAttributes()) 387var 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)
88foreach (AttributeData attr in symbol.GetAttributes())
JSImportGenerator.cs (1)
88foreach (AttributeData attr in symbol.GetAttributes())
Microsoft.Interop.LibraryImportGenerator (13)
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)
683foreach (AttributeData attrLocal in method.GetAttributes())
Analyzers\CustomMarshallerAttributeFixer.cs (1)
182=> (ITypeSymbol)attributedTypeSymbol.GetAttributes().First(attr =>
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (3)
106foreach (AttributeData attr in method.GetAttributes()) 141foreach (AttributeData attr in method.GetAttributes()) 279foreach (AttributeData attr in symbol.GetAttributes())
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
60AttributeData? attrData = containingType.GetAttributes().FirstOrDefault(
ErrorHandlingInfoParser.cs (1)
16foreach (AttributeData candidate in method.GetAttributes())
LibraryImportGenerator.cs (1)
221foreach (AttributeData attr in symbol.GetAttributes())
parent\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
241&& !parameter.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute))
Microsoft.Interop.LibraryImportGenerator.Downlevel (4)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (3)
108foreach (AttributeData attr in method.GetAttributes()) 143foreach (AttributeData attr in method.GetAttributes()) 277foreach (AttributeData attr in symbol.GetAttributes())
DownlevelLibraryImportGenerator.cs (1)
197foreach (AttributeData attr in symbol.GetAttributes())
Microsoft.Interop.SourceGeneration (18)
ComInterfaceMarshallingInfoProvider.cs (1)
137foreach (AttributeData attr in interfaceType.GetAttributes())
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 (4)
113&& entryPointType.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.ContiguousCollectionMarshallerAttribute); 118return entryPointType.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.CustomMarshallerAttribute); 137foreach (AttributeData attr in entryPointType.GetAttributes()) 219var attrs = entryPointType.GetAttributes().Where(attr => attr.AttributeClass.ToDisplayString() == TypeNames.CustomMarshallerAttribute).ToArray();
MarshallingInfoParser.cs (1)
243if (GetMarshallingInfoForAttributes(type.GetAttributes().AsSpan(), type, indirectionDepth, useSiteAttributes, GetMarshallingInfo) is MarshallingInfo info)
MethodSignatureElementInfoProvider.cs (2)
50marshallingInfoCallback(param.Type, new UseSiteAttributeProvider(_useSiteAttributeParsers, param.GetAttributes(), rootProvider, _generatorDiagnostics, marshallingInfoCallback), 0), _compilation) with 72marshallingInfoCallback(param.Type, new UseSiteAttributeProvider(_useSiteAttributeParsers, param.GetAttributes(), rootProvider, _generatorDiagnostics, marshallingInfoCallback), 0), _compilation) with
SignatureContext.cs (5)
109? property.GetAttributes() 123? MergeAccessorAndPropertyAttributes(param.GetAttributes(), associatedPropertyAttributes) 124: param.GetAttributes(); 323if (method.GetAttributes().Any(IsSkipLocalsInitAttribute)) 330if (type.GetAttributes().Any(IsSkipLocalsInitAttribute))
TypePositionInfo.cs (1)
93ByValueContentsMarshalKind = GetByValueContentsMarshalKind(paramSymbol.GetAttributes(), compilation),
TypeSymbolExtensions.cs (2)
118foreach (AttributeData attr in type.GetAttributes()) 135foreach (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"))
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\roslyn\src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
220var attributes = symbol.GetAttributes(); 392|| namedType.GetAttributes().Any((a) =>
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
538foreach (var attribute in method.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
247foreach (var attribute in symbol.GetAttributes())
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
155var current = type.GetAttributes(); 186foreach (var attributeClassData in currentAttributeClass.GetAttributes()) 222var current = type.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
149var attribute = collectionExpressionType.GetAttributes().FirstOrDefault(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (4)
577var attributeUsageAttribute = currentType.GetAttributes() 857if (symbol.GetAttributes().Any(static x => x.AttributeClass is 864if (!symbol.GetAttributes().Any(static x => x.AttributeClass is 885return symbol.GetAttributes().Any(static (attribute, attributeClass) => attributeClass.Equals(attribute.AttributeClass), attributeClass);
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
42foreach (var attribute in typeSymbol.GetAttributes())
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
298attributes ?? parameter.GetAttributes(),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IParameterSymbolExtensions.cs (2)
27parameter.GetAttributes(), 39return parameter.GetAttributes() == attributes
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
57attributeLists: AttributeGenerator.GenerateAttributeLists(constructor.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (1)
68attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (1)
53attributeLists: AttributeGenerator.GenerateAttributeLists(destructor.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (2)
120AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info), 150var attributes = @event.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
100AttributeGenerator.GenerateAttributeLists(field.GetAttributes(), info),
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
265return AttributeGenerator.GenerateAttributeLists(namedType.GetAttributes(), info);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (1)
95attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
121var attributes = parameter.GetAttributes();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
149var attributes = property.GetAttributes();
src\roslyn\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 (10)
Helpers\RoslynExtensions.cs (2)
145=> attributeType != null && memberInfo.GetAttributes().Any(attr => SymbolEqualityComparer.Default.Equals(attr.AttributeClass, attributeType)); 784return symbol.GetAttributes().Any(attr =>
JsonSourceGenerator.Parser.cs (8)
242foreach (AttributeData attributeData in symbol.GetAttributes()) 300foreach (AttributeData attributeData in contextClassSymbol.GetAttributes()) 340foreach (AttributeData attributeData in contextTypeSymbol.GetAttributes()) 979foreach (AttributeData attributeData in typeToGenerate.Type.GetAttributes()) 1538foreach (AttributeData attr in namedType.GetAttributes()) 1965foreach (AttributeData attr in type.GetAttributes()) 1984foreach (AttributeData attr in type.GetAttributes()) 2610foreach (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.Analyzers.VisualBasic (1)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (1)
73If propertySymbol.GetAttributes().Any(
System.Windows.Forms.PrivateSourceGenerators (1)
System\Windows\Forms\SourceGenerators\EnumValidationGenerator.cs (1)
223bool isFlags = enumType.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, flagsAttributeType));