6 implementations of GetAttributes
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
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)
120ImmutableArray<AttributeData> ISymbol.GetAttributes()
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
86public ImmutableArray<AttributeData> GetAttributes()
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1286Private Function ISymbol_GetAttributes() As ImmutableArray(Of AttributeData) Implements ISymbol.GetAttributes
Microsoft.CodeAnalysis.Workspaces (1)
CodeGenerationSymbol.cs (1)
164public ImmutableArray<AttributeData> GetAttributes()
150 references to GetAttributes
Microsoft.CodeAnalysis (7)
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
275var attributes = symbol.GetAttributes().Where(a => IsSuppressionAttribute(a)); 311var attributes = symbol.GetAttributes().Where(a => IsSuppressionAttribute(a));
InternalUtilities\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"/>. 145addMatchingAttributes(symbol.GetAttributes()); 151addMatchingAttributes(module.GetAttributes());
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (1)
144foreach (var attribute in typeSymbol.GetAttributes())
Microsoft.CodeAnalysis.CodeStyle (13)
AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (3)
143!symbol.GetAttributes().Any( 153return symbol.GetAttributes().Any(static (x, dataMemberAttribute) => SymbolEqualityComparer.Default.Equals(x.AttributeClass, dataMemberAttribute), dataMemberAttribute) 154&& symbol.ContainingType.GetAttributes().Any(static (x, dataContractAttribute) => SymbolEqualityComparer.Default.Equals(x.AttributeClass, dataContractAttribute), dataContractAttribute);
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
780foreach (var attribute in symbol.GetAttributes())
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (3)
394if (symbolEndContext.Symbol.GetAttributes().Any(static (a, self) => a.AttributeClass == self._structLayoutAttributeType, this)) 587foreach (var attribute in symbol.GetAttributes()) 718=> methodSymbol.GetAttributes().Any(static (a, self) => self._attributeSetForMethodsToIgnore.Contains(a.AttributeClass), this);
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
249if (method.GetAttributes().Any(static (a, self) => self._attributeSetForMethodsToIgnore.Contains(a.AttributeClass), this))
AbstractUseAutoPropertyAnalyzer.cs (1)
251var attributes = getterField.GetAttributes();
GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
IMethodSymbolExtensions.cs (1)
122method.ReturnType.GetAttributes().Any(a => a.AttributeClass?.Equals(compilation.AsyncMethodBuilderAttribute()) ?? false);
ISymbolExtensions.cs (1)
742=> symbol.GetAttributes().Any(static x => x.AttributeClass is
ITypeSymbolExtensions.cs (1)
701foreach (var attributeData in type.ContainingAssembly.GetAttributes())
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
AbstractFlagsEnumGenerator.cs (1)
41foreach (var attribute in typeSymbol.GetAttributes())
CodeGenerationSymbolFactory.cs (1)
302attributes ?? parameter.GetAttributes(),
INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
176if (invokedMethod.GetAttributes().Any(a => Equals(a.AttributeClass, conditionalAttributeType)))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (14)
ConstructorGenerator.cs (1)
56attributeLists: AttributeGenerator.GenerateAttributeLists(constructor.GetAttributes(), info),
ConversionGenerator.cs (1)
64attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
131type.GetAttributes().Any(static (attribute, flagsAttribute) => flagsAttribute.Equals(attribute.AttributeClass), flagsAttribute);
DestructorGenerator.cs (1)
50attributeLists: AttributeGenerator.GenerateAttributeLists(destructor.GetAttributes(), info),
EventGenerator.cs (2)
117AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info), 130attributeLists: AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info),
FieldGenerator.cs (1)
98AttributeGenerator.GenerateAttributeLists(field.GetAttributes(), info),
MethodGenerator.cs (1)
199attributes.AddRange(AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info));
NamedTypeGenerator.cs (1)
260return AttributeGenerator.GenerateAttributeLists(namedType.GetAttributes(), info);
OperatorGenerator.cs (1)
90attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
ParameterGenerator.cs (1)
127var attributes = parameter.GetAttributes();
PropertyGenerator.cs (2)
95attributeLists: AttributeGenerator.GenerateAttributeLists(property.GetAttributes(), info), 120attributeLists: AttributeGenerator.GenerateAttributeLists(property.GetAttributes(), info),
TypeParameterGenerator.cs (1)
32AttributeGenerator.GenerateAttributeLists(symbol.GetAttributes(), info),
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
Emit\InAttributeModifierTests.cs (1)
51Assert.Empty(m.Parameters[0].GetAttributes());
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (7)
Attributes\AttributeTests.cs (3)
712var attrs = m0.GetAttributes(); 5425var args = info.Symbol.GetAttributes()[0].CommonConstructorArguments; 10767var 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;
Microsoft.CodeAnalysis.CSharp.Features (4)
CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
176if (invokedMethod.GetAttributes().Any(a => Equals(a.AttributeClass, conditionalAttributeType)))
CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
131type.GetAttributes().Any(static (attribute, flagsAttribute) => flagsAttribute.Equals(attribute.AttributeClass), flagsAttribute);
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
100field.GetAttributes(),
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
143return info.ConvertedType.GetAttributes().Any(static (c, coclassSymbol) => c.AttributeClass?.Equals(coclassSymbol) == true, coclassSymbol);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (11)
Semantics\LambdaDiscardParametersTests.cs (1)
395static ImmutableArray<string> getParameterAttributes(IParameterSymbol parameter) => parameter.GetAttributes().SelectAsArray(a => a.ToString());
Semantics\LambdaTests.cs (5)
3635return format(expr, method.GetAttributes(), method.GetReturnTypeAttributes(), method.Parameters.SelectMany(p => p.GetAttributes())); 3881verifyAttributes(symbol.GetAttributes(), "PropAttribute", "ReturnAttribute", "MethodAttribute"); 3883verifyAttributes(symbol.Parameters[0].GetAttributes(), "ParamAttribute", "TypeParamAttribute"); 4079Assert.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();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelAPITests.cs (1)
4453var attribute = method.GetAttributes().Single();
Microsoft.CodeAnalysis.CSharp.Workspaces (13)
ConstructorGenerator.cs (1)
56attributeLists: AttributeGenerator.GenerateAttributeLists(constructor.GetAttributes(), info),
ConversionGenerator.cs (1)
64attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
DestructorGenerator.cs (1)
50attributeLists: AttributeGenerator.GenerateAttributeLists(destructor.GetAttributes(), info),
EventGenerator.cs (2)
117AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info), 130attributeLists: AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), info),
FieldGenerator.cs (1)
98AttributeGenerator.GenerateAttributeLists(field.GetAttributes(), info),
MethodGenerator.cs (1)
199attributes.AddRange(AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info));
NamedTypeGenerator.cs (1)
260return AttributeGenerator.GenerateAttributeLists(namedType.GetAttributes(), info);
OperatorGenerator.cs (1)
90attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), info),
ParameterGenerator.cs (1)
127var attributes = parameter.GetAttributes();
PropertyGenerator.cs (2)
95attributeLists: AttributeGenerator.GenerateAttributeLists(property.GetAttributes(), info), 120attributeLists: AttributeGenerator.GenerateAttributeLists(property.GetAttributes(), info),
TypeParameterGenerator.cs (1)
32AttributeGenerator.GenerateAttributeLists(symbol.GetAttributes(), info),
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.cs (1)
235return typeC.GetAttributes().First();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
CodeGeneration\CodeGenerationTests.cs (1)
568var attribute = attributeTarget.GetAttributes().Single(attr => Equals(attr.AttributeClass, attributeType));
Microsoft.CodeAnalysis.Features (22)
AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (3)
143!symbol.GetAttributes().Any( 153return symbol.GetAttributes().Any(static (x, dataMemberAttribute) => SymbolEqualityComparer.Default.Equals(x.AttributeClass, dataMemberAttribute), dataMemberAttribute) 154&& symbol.ContainingType.GetAttributes().Any(static (x, dataContractAttribute) => SymbolEqualityComparer.Default.Equals(x.AttributeClass, dataContractAttribute), dataContractAttribute);
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
780foreach (var attribute in symbol.GetAttributes())
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (3)
394if (symbolEndContext.Symbol.GetAttributes().Any(static (a, self) => a.AttributeClass == self._structLayoutAttributeType, this)) 587foreach (var attribute in symbol.GetAttributes()) 718=> methodSymbol.GetAttributes().Any(static (a, self) => self._attributeSetForMethodsToIgnore.Contains(a.AttributeClass), this);
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
249if (method.GetAttributes().Any(static (a, self) => self._attributeSetForMethodsToIgnore.Contains(a.AttributeClass), this))
AbstractUseAutoPropertyAnalyzer.cs (1)
251var attributes = getterField.GetAttributes();
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (1)
109=> typeSymbol.GetAttributes()
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (1)
78parameters: method.Parameters.SelectAsArray(p => CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type, p.Name)),
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
261var attribute = type.GetAttributes().FirstOrDefault(d => IsDesignerAttribute(d.AttributeClass));
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (4)
3643foreach (var attributeData in current.GetAttributes()) 4328hasAttributeChange = ReportCustomAttributeRudeEdits(diagnostics, oldSymbol.GetAttributes(), newSymbol.GetAttributes(), oldSymbol, newSymbol, newNode, newCompilation, capabilities, cancellationToken); 4748var attributes = type.GetAttributes();
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
319foreach (var attribute in symbol.GetAttributes())
ExtractClass\ExtractClassWithDialogCodeAction.cs (1)
92_selectedType.GetAttributes(),
ExtractMethod\MethodExtractor.CodeGenerator.cs (1)
338parameter.GetAttributes(), parameter.Variance, parameter.Name, ImmutableArray.Create<ITypeSymbol>(), parameter.NullableAnnotation,
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
87=> _symbol.GetAttributes();
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (1)
85useDecompiler = !symbol.ContainingAssembly.GetAttributes().Any(static attribute => attribute.AttributeClass?.Name == nameof(SuppressIldasmAttribute)
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
99foreach (var attribute in assemblySymbol.GetAttributes())
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1286Private Function ISymbol_GetAttributes() As ImmutableArray(Of AttributeData) Implements ISymbol.GetAttributes
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
Utilities\NamedTypeSymbolExtensions.vb (1)
21If Not type.GetAttributes().Where(Function(a) Equals(a.AttributeClass, designerGeneratedAttribute)).Any() Then
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (4)
Attributes\AttributeTests.vb (1)
2244Dim attrs = m0.GetAttributes()
Attributes\AttributeTests_WellKnownAttributes.vb (3)
457AssertEx.SetEqual({"System.SerializableAttribute", "BobAttribute"}, typeC.GetAttributes().Select(Function(a) a.ToString())) 471AssertEx.SetEqual({"System.SerializableAttribute", "BobAttribute"}, typeC1.GetAttributes().Select(Function(a) a.ToString())) 480AssertEx.SetEqual({"BobAttribute"}, typeC2.GetAttributes().Select(Function(a) a.ToString()))
Microsoft.CodeAnalysis.VisualBasic.Features (3)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (2)
293eventType.GetAttributes(), eventType.DeclaredAccessibility, 299boundEvent.GetAttributes(), boundEvent.DeclaredAccessibility,
ExtractMethod\VisualBasicSelectionResult.vb (1)
216Return info.ConvertedType.GetAttributes().Any(Function(c) c.AttributeClass.Equals(coclassSymbol))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (13)
CodeGeneration\ConstructorGenerator.vb (1)
40.WithAttributeLists(AttributeGenerator.GenerateAttributeBlocks(constructor.GetAttributes(), options)) _
CodeGeneration\ConversionGenerator.vb (1)
51AttributeGenerator.GenerateAttributeBlocks(method.GetAttributes(), options),
CodeGeneration\EventGenerator.vb (4)
122result.WithAttributeLists(GenerateAttributeBlocks([event].GetAttributes(), options)), 144attributeLists:=GenerateAttributeBlocks([event].GetAttributes(), options), 153attributeLists:=GenerateAttributeBlocks([event].GetAttributes(), options), 192Return CodeGenerationSymbolFactory.CreateParameterSymbol(parameter.GetAttributes(), parameter.RefKind, isParams:=False, type:=parameter.Type, name:=parameter.Name, hasDefaultValue:=False)
CodeGeneration\FieldGenerator.vb (1)
83AttributeGenerator.GenerateAttributeBlocks(field.GetAttributes(), options),
CodeGeneration\MethodGenerator.vb (1)
79WithAttributeLists(AttributeGenerator.GenerateAttributeBlocks(method.GetAttributes(), options)).
CodeGeneration\NamedTypeGenerator.vb (1)
161Return AttributeGenerator.GenerateAttributeBlocks(namedType.GetAttributes(), options)
CodeGeneration\OperatorGenerator.vb (1)
46AttributeGenerator.GenerateAttributeBlocks(method.GetAttributes(), options),
CodeGeneration\ParameterGenerator.vb (2)
54GenerateAttributeBlocks(parameter.GetAttributes(), options), 66GenerateAttributeBlocks(parameter.GetAttributes(), options),
CodeGeneration\PropertyGenerator.vb (1)
70WithAttributeLists(AttributeGenerator.GenerateAttributeBlocks([property].GetAttributes(), options)).
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.vb (1)
213Return typeC.GetAttributes().First()
Microsoft.CodeAnalysis.Workspaces (24)
AbstractFlagsEnumGenerator.cs (1)
41foreach (var attribute in typeSymbol.GetAttributes())
CodeGenerationSymbolFactory.cs (1)
302attributes ?? parameter.GetAttributes(),
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
239foreach (var attr in assembly.GetAttributes().Where(IsInternalsVisibleToAttribute))
GeneratedCodeUtilities.cs (1)
36foreach (var attribute in symbol.GetAttributes())
IMethodSymbolExtensions.cs (1)
122method.ReturnType.GetAttributes().Any(a => a.AttributeClass?.Equals(compilation.AsyncMethodBuilderAttribute()) ?? false);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs\ISymbolExtensions.cs (1)
742=> symbol.GetAttributes().Any(static x => x.AttributeClass is
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs\ITypeSymbolExtensions.cs (1)
701foreach (var attributeData in type.ContainingAssembly.GetAttributes())
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs\INamedTypeSymbolExtensions.cs (1)
21namedType.GetAttributes(),
Shared\Extensions\IMethodSymbolExtensions.cs (8)
77method.GetAttributes(), 86CodeGenerationSymbolFactory.CreateParameterSymbol(p.GetAttributes(), p.RefKind, p.IsParams, p.Type.SubstituteTypes(mapping, typeGenerator), p.Name, p.IsOptional, 103method.GetAttributes(), 130typeParameter.GetAttributes(), 187var methodHasAttribute = method.GetAttributes().Any(shouldRemoveAttribute, arg); 190.Any(static (m, arg) => m.GetAttributes().Any(shouldRemoveAttribute, arg), arg); 203attributes: method.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg), 206p.GetAttributes().WhereAsArray(static (a, arg) => !shouldRemoveAttribute(a, arg), arg),
Shared\Extensions\IParameterSymbolExtensions.cs (2)
21parameter.GetAttributes(), 33return parameter.GetAttributes() == attributes
Shared\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),
Shared\Extensions\ISymbolExtensions.cs (2)
97var attributes = symbol.GetAttributes(); 120attributes = attributes.IsDefault ? symbol.GetAttributes() : attributes;
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (4)
VisualStudioMSBuildWorkspaceTests.cs (4)
1893var attrs = sym.GetAttributes(); 1916var attrs = sym.GetAttributes(); 1940var attrs = sym.GetAttributes(); 1963var attrs = sym.GetAttributes();