3 types derived from AttributeData
Microsoft.CodeAnalysis.CSharp (1)
Microsoft.CodeAnalysis.VisualBasic (1)
Mvc.Api.Analyzers.Test (1)
664 references to AttributeData
ConfigurationSchemaGenerator (3)
ILLink.RoslynAnalyzer (47)
Microsoft.Analyzers.Extra (6)
Microsoft.Analyzers.Local (2)
Microsoft.AspNetCore.App.Analyzers (40)
src\Shared\RoslynUtils\SymbolExtensions.cs (14)
54foreach (var attributeData in symbol.GetAttributes())
65public static bool HasAttribute(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol attributeType)
70public static bool TryGetAttribute(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol attributeType, [NotNullWhen(true)] out AttributeData? matchedAttribute)
72foreach (var attributeData in attributes)
87return symbol.TryGetAttributeImplementingInterface(interfaceType, out var _);
90public static bool TryGetAttributeImplementingInterface(this ISymbol symbol, INamedTypeSymbol interfaceType, [NotNullWhen(true)] out AttributeData? matchedAttribute)
92foreach (var attributeData in symbol.GetAttributes())
105public static bool HasAttributeImplementingInterface(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol interfaceType)
107return attributes.TryGetAttributeImplementingInterface(interfaceType, out var _);
110public static bool TryGetAttributeImplementingInterface(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol interfaceType, [NotNullWhen(true)] out AttributeData? matchedAttribute)
112foreach (var attributeData in attributes)
203public static bool TryGetNamedArgumentValue<T>(this AttributeData attribute, string argumentName, out T? argumentValue)
Microsoft.AspNetCore.Components.Analyzers (1)
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (25)
src\Shared\RoslynUtils\SymbolExtensions.cs (14)
54foreach (var attributeData in symbol.GetAttributes())
65public static bool HasAttribute(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol attributeType)
70public static bool TryGetAttribute(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol attributeType, [NotNullWhen(true)] out AttributeData? matchedAttribute)
72foreach (var attributeData in attributes)
87return symbol.TryGetAttributeImplementingInterface(interfaceType, out var _);
90public static bool TryGetAttributeImplementingInterface(this ISymbol symbol, INamedTypeSymbol interfaceType, [NotNullWhen(true)] out AttributeData? matchedAttribute)
92foreach (var attributeData in symbol.GetAttributes())
105public static bool HasAttributeImplementingInterface(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol interfaceType)
107return attributes.TryGetAttributeImplementingInterface(interfaceType, out var _);
110public static bool TryGetAttributeImplementingInterface(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol interfaceType, [NotNullWhen(true)] out AttributeData? matchedAttribute)
112foreach (var attributeData in attributes)
203public static bool TryGetNamedArgumentValue<T>(this AttributeData attribute, string argumentName, out T? argumentValue)
StaticRouteHandlerModel\EndpointParameter.cs (11)
38var attributeBuilder = ImmutableArray.CreateBuilder<AttributeData>();
67private void ProcessEndpointParameterSource(Endpoint endpoint, ISymbol symbol, ImmutableArray<AttributeData> attributes, WellKnownTypes wellKnownTypes)
69if (attributes.TryGetAttributeImplementingInterface(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_Metadata_IFromRouteMetadata), out var fromRouteAttribute))
76else if (attributes.TryGetAttributeImplementingInterface(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_Metadata_IFromQueryMetadata), out var fromQueryAttribute))
83else if (attributes.TryGetAttributeImplementingInterface(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_Metadata_IFromHeaderMetadata), out var fromHeaderAttribute))
90else if (attributes.TryGetAttributeImplementingInterface(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_Metadata_IFromFormMetadata), out var fromFormAttribute))
149if (attributes.TryGetAttribute(wellKnownTypes.Get(WellKnownType.Microsoft_Extensions_DependencyInjection_FromKeyedServicesAttribute), out var keyedServicesAttribute))
155else if (attributes.TryGetAttribute(wellKnownTypes.Get(WellKnownType.Microsoft_Extensions_DependencyInjection_FromKeyedServicesAttribute), out var keyedServicesAttribute))
423ImmutableArray<AttributeData> attributes,
428if (!attributes.TryGetAttributeImplementingInterface(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_Metadata_IFromBodyMetadata), out var fromBodyAttribute))
445private static string GetEscapedParameterName(AttributeData attribute, string parameterName)
Microsoft.AspNetCore.Mvc.Analyzers (15)
Microsoft.AspNetCore.Mvc.Api.Analyzers (22)
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
Microsoft.CodeAnalysis (43)
Diagnostic\CommonMessageProvider.cs (6)
260protected abstract void ReportInvalidAttributeArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute);
262public void ReportInvalidAttributeArgument(BindingDiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute)
290protected abstract void ReportMarshalUnmanagedTypeNotValidForFields(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute);
292public void ReportMarshalUnmanagedTypeNotValidForFields(BindingDiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute)
300protected abstract void ReportMarshalUnmanagedTypeOnlyValidForFields(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute);
302public void ReportMarshalUnmanagedTypeOnlyValidForFields(BindingDiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute)
Microsoft.CodeAnalysis.CodeStyle (8)
Microsoft.CodeAnalysis.CodeStyle.Fixes (70)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (4)
98public TDeclarationNode AddAttributes<TDeclarationNode>(TDeclarationNode destination, IEnumerable<AttributeData> attributes, SyntaxToken? target, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
104public TDeclarationNode RemoveAttribute<TDeclarationNode>(TDeclarationNode destination, AttributeData attributeToRemove, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
133public abstract TDeclarationNode AddAttributes<TDeclarationNode>(TDeclarationNode destination, IEnumerable<AttributeData> attributes, SyntaxToken? target, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
135public abstract TDeclarationNode RemoveAttribute<TDeclarationNode>(TDeclarationNode destination, AttributeData attributeToRemove, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (29)
34ImmutableArray<AttributeData> attributes, Accessibility accessibility,
49ImmutableArray<AttributeData> attributes,
83ImmutableArray<AttributeData> attributes, Accessibility accessibility, DeclarationModifiers modifiers,
107ImmutableArray<AttributeData> attributes,
124ImmutableArray<AttributeData> attributes,
143ImmutableArray<AttributeData> attributes, string typeName,
153ImmutableArray<AttributeData> attributes,
164ImmutableArray<AttributeData> returnTypeAttributes = default,
177ImmutableArray<AttributeData> attributes, Accessibility accessibility, DeclarationModifiers modifiers,
185ImmutableArray<AttributeData> returnTypeAttributes = default,
196ImmutableArray<AttributeData> attributes,
203ImmutableArray<AttributeData> returnTypeAttributes = default,
229ImmutableArray<AttributeData> toTypeAttributes = default,
249ImmutableArray<AttributeData> attributes,
257ImmutableArray<AttributeData> toTypeAttributes = default,
281ImmutableArray<AttributeData> attributes, RefKind refKind, bool isParams, ITypeSymbol type, string name, bool isOptional = false, bool hasDefaultValue = false, object? defaultValue = null)
291ImmutableArray<AttributeData>? attributes = null,
333ImmutableArray<AttributeData> attributes,
362ImmutableArray<AttributeData> attributes = default,
387ImmutableArray<AttributeData> attributes,
407public static AttributeData CreateAttributeData(
419ImmutableArray<AttributeData> attributes,
438ImmutableArray<AttributeData> attributes,
464ImmutableArray<AttributeData> attributes,
516ImmutableArray<AttributeData> attributes = default,
525Optional<ImmutableArray<AttributeData>> returnTypeAttributes = default)
546ImmutableArray<AttributeData> attributes = default,
572ImmutableArray<AttributeData> attributes = default,
593ImmutableArray<AttributeData> attributes = default,
Microsoft.CodeAnalysis.CSharp (12)
Errors\MessageProvider.cs (3)
258protected override void ReportInvalidAttributeArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute)
276protected override void ReportMarshalUnmanagedTypeNotValidForFields(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute)
281protected override void ReportMarshalUnmanagedTypeOnlyValidForFields(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (13)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (6)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (10)
CodeGeneration\CodeGenerationTests.VisualBasic.cs (5)
424ImmutableArray<AttributeData>.Empty, Accessibility.NotApplicable, ImmutableArray<SyntaxNode>.Empty),
448addMethod: CodeGenerationSymbolFactory.CreateAccessorSymbol(ImmutableArray<AttributeData>.Empty, Accessibility.NotApplicable, ImmutableArray<SyntaxNode>.Empty),
477ImmutableArray<AttributeData>.Empty, Accessibility.NotApplicable, addStatements),
479ImmutableArray<AttributeData>.Empty, Accessibility.NotApplicable, removeStatements),
481ImmutableArray<AttributeData>.Empty, Accessibility.NotApplicable, raiseStatements),
Microsoft.CodeAnalysis.Features (15)
Microsoft.CodeAnalysis.Test.Utilities (3)
Mocks\TestMessageProvider.cs (3)
268protected override void ReportInvalidAttributeArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute)
283protected override void ReportMarshalUnmanagedTypeNotValidForFields(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute)
288protected override void ReportMarshalUnmanagedTypeOnlyValidForFields(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute)
Microsoft.CodeAnalysis.VisualBasic (14)
Errors\MessageProvider.vb (3)
482Protected Overrides Sub ReportInvalidAttributeArgument(diagnostics As DiagnosticBag, attributeSyntax As SyntaxNode, parameterIndex As Integer, attribute As AttributeData)
497Protected Overrides Sub ReportMarshalUnmanagedTypeNotValidForFields(diagnostics As DiagnosticBag, attributeSyntax As SyntaxNode, parameterIndex As Integer, unmanagedTypeName As String, attribute As AttributeData)
502Protected Overrides Sub ReportMarshalUnmanagedTypeOnlyValidForFields(diagnostics As DiagnosticBag, attributeSyntax As SyntaxNode, parameterIndex As Integer, unmanagedTypeName As String, attribute As AttributeData)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (7)
Microsoft.CodeAnalysis.VisualBasic.Features (4)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (6)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces (88)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (4)
98public TDeclarationNode AddAttributes<TDeclarationNode>(TDeclarationNode destination, IEnumerable<AttributeData> attributes, SyntaxToken? target, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
104public TDeclarationNode RemoveAttribute<TDeclarationNode>(TDeclarationNode destination, AttributeData attributeToRemove, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
133public abstract TDeclarationNode AddAttributes<TDeclarationNode>(TDeclarationNode destination, IEnumerable<AttributeData> attributes, SyntaxToken? target, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
135public abstract TDeclarationNode RemoveAttribute<TDeclarationNode>(TDeclarationNode destination, AttributeData attributeToRemove, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (29)
34ImmutableArray<AttributeData> attributes, Accessibility accessibility,
49ImmutableArray<AttributeData> attributes,
83ImmutableArray<AttributeData> attributes, Accessibility accessibility, DeclarationModifiers modifiers,
107ImmutableArray<AttributeData> attributes,
124ImmutableArray<AttributeData> attributes,
143ImmutableArray<AttributeData> attributes, string typeName,
153ImmutableArray<AttributeData> attributes,
164ImmutableArray<AttributeData> returnTypeAttributes = default,
177ImmutableArray<AttributeData> attributes, Accessibility accessibility, DeclarationModifiers modifiers,
185ImmutableArray<AttributeData> returnTypeAttributes = default,
196ImmutableArray<AttributeData> attributes,
203ImmutableArray<AttributeData> returnTypeAttributes = default,
229ImmutableArray<AttributeData> toTypeAttributes = default,
249ImmutableArray<AttributeData> attributes,
257ImmutableArray<AttributeData> toTypeAttributes = default,
281ImmutableArray<AttributeData> attributes, RefKind refKind, bool isParams, ITypeSymbol type, string name, bool isOptional = false, bool hasDefaultValue = false, object? defaultValue = null)
291ImmutableArray<AttributeData>? attributes = null,
333ImmutableArray<AttributeData> attributes,
362ImmutableArray<AttributeData> attributes = default,
387ImmutableArray<AttributeData> attributes,
407public static AttributeData CreateAttributeData(
419ImmutableArray<AttributeData> attributes,
438ImmutableArray<AttributeData> attributes,
464ImmutableArray<AttributeData> attributes,
516ImmutableArray<AttributeData> attributes = default,
525Optional<ImmutableArray<AttributeData>> returnTypeAttributes = default)
546ImmutableArray<AttributeData> attributes = default,
572ImmutableArray<AttributeData> attributes = default,
593ImmutableArray<AttributeData> attributes = default,
Microsoft.Extensions.Logging.Generators (2)
Microsoft.Extensions.Options.SourceGeneration (5)
Microsoft.Gen.ComplianceReports (8)
Microsoft.Gen.Logging (17)
Microsoft.Gen.Logging.Unit.Tests (3)
Microsoft.Gen.Metrics (6)
Microsoft.Gen.MetricsReports (6)
Microsoft.Interop.ComInterfaceGenerator (36)
Microsoft.Interop.JavaScript.JSImportGenerator (8)
Microsoft.Interop.LibraryImportGenerator (21)
Microsoft.Interop.LibraryImportGenerator.Downlevel (7)
Microsoft.Interop.SourceGeneration (43)
MarshallingInfoParser.cs (12)
18public sealed record UseSiteAttributeData(int IndirectionDepth, CountInfo CountInfo, AttributeData AttributeData);
48UseSiteAttributeData ParseAttribute(AttributeData attributeData, IElementInfoProvider elementInfoProvider, GetMarshallingInfoCallback marshallingInfoCallback);
72MarshallingInfo? ParseAttribute(AttributeData attributeData, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback);
117bool TryGetInfoForElementName(AttributeData attrData, string elementName, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, out TypePositionInfo info);
127bool TryGetInfoForParamIndex(AttributeData attrData, int paramIndex, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, out TypePositionInfo info);
143public static bool TryGetInfoForElementName(this IElementInfoProvider provider, AttributeData attrData, string elementName, GetMarshallingInfoCallback marshallingInfoCallback, out TypePositionInfo info)
156public static bool TryGetInfoForParamIndex(this IElementInfoProvider provider, AttributeData attrData, int paramIndex, GetMarshallingInfoCallback marshallingInfoCallback, out TypePositionInfo info)
214IEnumerable<AttributeData> useSiteAttributes)
242foreach (AttributeData typeAttribute in type.GetAttributes())
255private MarshallingInfo? GetMarshallingInfoForAttribute(AttributeData attribute, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
298public bool TryGetInfoForElementName(AttributeData attrData, string elementName, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, [NotNullWhen(true)] out TypePositionInfo? info)
325public bool TryGetInfoForParamIndex(AttributeData attrData, int paramIndex, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, [NotNullWhen(true)] out TypePositionInfo? info)
Microsoft.ML.InternalCodeAnalyzer (3)
Mvc.Api.Analyzers.Test (4)
System.Private.CoreLib.Generators (4)
System.Text.Json.SourceGeneration (8)
System.Text.RegularExpressions.Generator (2)