397 references to AttributeClass
Aspire.Hosting.Analyzers (3)
AppHostAnalyzer.cs (3)
104.Where(a => WellKnownTypes.Implements(a.AttributeClass, modelNameParameter)); 109SymbolEqualityComparer.Default.Equals(a?.AttributeClass, resourceNameAttribute) 111: SymbolEqualityComparer.Default.Equals(a?.AttributeClass, endpointNameAttribute)
ConfigurationSchemaGenerator (5)
ConfigSchemaEmitter.cs (2)
421if (attribute.AttributeClass?.ToDisplayString() == "System.ObsoleteAttribute") 425else if (attribute.AttributeClass?.ToDisplayString() == "System.ComponentModel.EditorBrowsableAttribute" &&
ConfigSchemaGenerator.cs (2)
62if (attribute.AttributeClass?.ToDisplayString() == ConfigurationSchemaAttributeName) 85else if (attribute.AttributeClass?.ToDisplayString() == LoggingCategoriesAttributeName)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
674AttributeData? attributeData = property.GetAttributes().FirstOrDefault(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _typeSymbols.ConfigurationKeyNameAttribute));
ILLink.RoslynAnalyzer (5)
ISymbolExtensions.cs (5)
23 if (attr.AttributeClass?.Name == attributeName) 33 if (attr.AttributeClass is { } attrClass && attrClass.HasName (attributeName)) { 45 if (attr.AttributeClass is { } attrClass && attrClass.HasName (attributeName)) 68 if (returnTypeAttribute.AttributeClass is var attrClass && attrClass != null && 94 if (attr.AttributeClass is { } attrClass && attrClass.HasName (attributeName)) {
Microsoft.Analyzers.Extra (12)
AsyncMethodWithoutCancellation.cs (1)
133SymbolEqualityComparer.Default.Equals(data.AttributeClass, obsoleteAttribute));
CallAnalysis\Arrays.cs (2)
115if (keyType.GetAttributes().Any(a => a.AttributeClass != null && SymbolEqualityComparer.Default.Equals(a.AttributeClass, flagsAttr)))
CallAnalysis\Fixers\LegacyLoggingFixer.cs (2)
200if (SymbolEqualityComparer.Default.Equals(methodAttr.AttributeClass, logMethodAttribute) && 639if (SymbolEqualityComparer.Default.Equals(methodAttr.AttributeClass, logMethodAttribute) &&
ConditionalAccessAnalyzer.cs (1)
121if (SymbolEqualityComparer.Default.Equals(attr.AttributeClass, maybeNull))
MakeExeTypesInternalAnalyzer.cs (4)
99if (attr.AttributeClass != null) 101if (disqualifyingTypeAttributes.Contains(attr.AttributeClass)) 124if (attr.AttributeClass != null) 126if (disqualifyingMemberAttributes.Contains(attr.AttributeClass))
UsingToStringInLoggersAnalyzer.cs (2)
53return symbol.GetAttributes().Any(a => a.AttributeClass != null && IsLoggerMessageAttribute(a.AttributeClass));
Microsoft.Analyzers.Local (2)
Utilities\SymbolExtensions.cs (2)
41if (SymbolEqualityComparer.Default.Equals(a.AttributeClass, attribute)) 54var attrType = a.AttributeClass?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
Microsoft.AspNetCore.App.Analyzers (25)
Mvc\DetectAmbiguousActionRoutes.cs (2)
218if (attribute.AttributeClass is null) 223if (!wellKnownTypes.IsType(attribute.AttributeClass, KnownMethodAttributeTypes))
Mvc\DetectOverriddenAuthorizeAttribute.cs (3)
161if (attribute.AttributeClass is null) 168if (IsMatchingAttribute(wellKnownTypes, attribute.AttributeClass, authAttributeType, authInterfaceType, isCheckingBaseType)) 184if (IsMatchingAttribute(wellKnownTypes, attribute.AttributeClass, anonAttributeType, anonInterfaceType, isCheckingBaseType))
Mvc\MvcAnalyzer.cs (4)
99if (attribute.AttributeClass is null || !wellKnownTypes.IsType(attribute.AttributeClass, RouteAttributeTypes, out var match)) 124if (attribute.AttributeClass is null || !wellKnownTypes.IsType(attribute.AttributeClass, RouteAttributeTypes, out var match))
RouteEmbeddedLanguage\Infrastructure\RoutePatternParametersDetector.cs (1)
89var attributeClass = attributeData.AttributeClass;
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
336if (attribute.AttributeClass is not
RouteHandlers\DetectMisplacedLambdaAttribute.cs (2)
45if (IsInValidNamespace(attribute.AttributeClass?.ContainingNamespace)) 50attribute.AttributeClass?.Name,
RouteHandlers\DisallowMvcBindArgumentsOnParameters.cs (2)
27if (modelBindingAttribute?.AttributeClass is not null) 41modelBindingAttribute.AttributeClass.Name,
src\Shared\Roslyn\CodeAnalysisExtensions.cs (4)
25if (declaredAttribute.AttributeClass is not null && attribute.IsAssignableFrom(declaredAttribute.AttributeClass)) 135if (declaredAttribute.AttributeClass is not null && attribute.IsAssignableFrom(declaredAttribute.AttributeClass))
src\Shared\RoslynUtils\SymbolExtensions.cs (6)
56if (SymbolEqualityComparer.Default.Equals(attributeData.AttributeClass, attributeType)) 74if (SymbolEqualityComparer.Default.Equals(attributeData.AttributeClass, attributeType)) 94if (attributeData.AttributeClass is not null && attributeData.AttributeClass.Implements(interfaceType)) 114if (attributeData.AttributeClass is not null && attributeData.AttributeClass.Implements(interfaceType))
Microsoft.AspNetCore.Components.Analyzers (5)
ComponentFacts.cs (5)
27return SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute) || SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.CascadingParameterAttribute); 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.Components.SdkAnalyzers (5)
ComponentFacts.cs (5)
27return SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute) || SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.CascadingParameterAttribute); 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 (6)
src\Shared\RoslynUtils\SymbolExtensions.cs (6)
56if (SymbolEqualityComparer.Default.Equals(attributeData.AttributeClass, attributeType)) 74if (SymbolEqualityComparer.Default.Equals(attributeData.AttributeClass, attributeType)) 94if (attributeData.AttributeClass is not null && attributeData.AttributeClass.Implements(interfaceType)) 114if (attributeData.AttributeClass is not null && attributeData.AttributeClass.Implements(interfaceType))
Microsoft.AspNetCore.Mvc.Analyzers (9)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (4)
92attribute.AttributeClass.Name)); 106attribute.AttributeClass.Name)); 120attribute.AttributeClass.Name)); 128if (attributeType.IsAssignableFrom(attribute.AttributeClass))
src\Shared\Roslyn\CodeAnalysisExtensions.cs (4)
25if (declaredAttribute.AttributeClass is not null && attribute.IsAssignableFrom(declaredAttribute.AttributeClass)) 135if (declaredAttribute.AttributeClass is not null && attribute.IsAssignableFrom(declaredAttribute.AttributeClass))
TopLevelParameterNameAnalyzer.cs (1)
155var nameProperty = SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, symbolCache.BindAttribute) ? "Prefix" : "Name";
Microsoft.AspNetCore.Mvc.Api.Analyzers (5)
ActualApiResponseMetadataFactory.cs (1)
284if (attributes[i].AttributeClass.Name == attributeName)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (4)
25if (declaredAttribute.AttributeClass is not null && attribute.IsAssignableFrom(declaredAttribute.AttributeClass)) 135if (declaredAttribute.AttributeClass is not null && attribute.IsAssignableFrom(declaredAttribute.AttributeClass))
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
HubClientProxyGenerator.Parser.cs (1)
162if (!attributeData.AttributeClass.ToString()
HubServerProxyGenerator.Parser.cs (1)
152if (!attributeData.AttributeClass.ToString()
Microsoft.CodeAnalysis (25)
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
275=> a.AttributeClass == SuppressMessageAttribute || a.AttributeClass == UnconditionalSuppressMessageAttribute;
SourceGeneration\GeneratedCodeUtilities.cs (1)
38if (generatedCodeAttribute.Equals(attribute.AttributeClass))
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithMetadataName.cs (3)
36/// these attributes will have an <see cref="AttributeData.AttributeClass"/> whose fully qualified name metadata 76/// <see cref="AttributeData.AttributeClass"/> has the same fully qualified, metadata name as <paramref 164attribute.AttributeClass?.ToDisplayString(s_metadataDisplayFormat) == fullyQualifiedMetadataName)
Symbols\Attributes\CommonAttributeData.cs (8)
62[MemberNotNullWhen(false, nameof(AttributeClass)/*, nameof(AttributeConstructor)*/)] 67Debug.Assert(AttributeClass is not null); 436Debug.Assert(attribute.AttributeClass is object); 437messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, attribute.AttributeClass, "MethodCodeType"); 463Debug.Assert(attribute.AttributeClass is object); 503messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, attribute.AttributeClass, namedArg.Key); 516messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, attribute.AttributeClass, namedArg.Key); 526messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, attribute.AttributeClass, namedArg.Key);
Symbols\Attributes\CommonAttributeDataComparer.cs (3)
30return attr1.AttributeClass == attr2.AttributeClass && 42int hash = attr.AttributeClass?.GetHashCode() ?? 0;
Symbols\Attributes\MarshalAsAttributeDecoder.cs (8)
134messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key); 150messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key); 190messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key); 230messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key); 240messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key); 255messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key); 314messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key); 382messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.AttributeSyntaxOpt, position, arguments.Attribute.AttributeClass, namedArg.Key);
Microsoft.CodeAnalysis.CodeStyle (16)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (3)
173static (a, threadStaticAttribute) => SymbolEqualityComparer.Default.Equals(a.AttributeClass, threadStaticAttribute), 182return symbol.GetAttributes().Any(static (x, dataMemberAttribute) => SymbolEqualityComparer.Default.Equals(x.AttributeClass, dataMemberAttribute), dataMemberAttribute) 183&& symbol.ContainingType.GetAttributes().Any(static (x, dataContractAttribute) => SymbolEqualityComparer.Default.Equals(x.AttributeClass, dataContractAttribute), dataContractAttribute);
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
831if (suppressMessageAttributeType.Equals(attribute.AttributeClass) &&
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (3)
457if (symbolEndContext.Symbol.GetAttributes().Any(static (a, self) => a.AttributeClass == self._structLayoutAttributeType, this)) 710if (attribute.AttributeClass == _debuggerDisplayAttributeType && 865=> methodSymbol.GetAttributes().Any(static (a, self) => self._attributeSetForMethodsToIgnore.Contains(a.AttributeClass), this);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (2)
241if (method.GetAttributes().Any(static (a, self) => a.AttributeClass is { } attributeClass && self._attributeSetForMethodsToIgnore.Contains(attributeClass), this)) 309if (!containingType.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, interpolatedStringHandlerAttributeType)))
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
38if (generatedCodeAttribute.Equals(attribute.AttributeClass))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IMethodSymbolExtensions.cs (1)
123method.ReturnType.GetAttributes().Any(a => a.AttributeClass?.Equals(compilation.AsyncMethodBuilderAttribute()) ?? false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
794=> symbol.GetAttributes().Any(static x => x.AttributeClass is
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (3)
713if (attributeData.AttributeClass?.Name == nameof(ReferenceAssemblyAttribute) 714&& attributeData.AttributeClass.ToNameDisplayString() == typeof(ReferenceAssemblyAttribute).FullName) 764namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
47AttributeClass.Name: "InterceptsLocationAttribute",
Microsoft.CodeAnalysis.CodeStyle.Fixes (5)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
399=> attribute.AttributeClass is
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (2)
175=> arg.removeAttributeTypes.Any(attr => attr.Equals(a.AttributeClass)) || 176a.AttributeClass?.IsAccessibleWithin(arg.accessibleWithin) == false;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (2)
70=> arg.attributesToRemove.Any(attr => attr.Equals(a.AttributeClass)) || 71a.AttributeClass?.IsAccessibleWithin(arg.accessibleWithin) == false;
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
172if (invokedMethod.GetAttributes().Any(a => Equals(a.AttributeClass, conditionalAttributeType)))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
329if (namedType.GetAttributes().Any(a => a.AttributeClass.IsCollectionBuilderAttribute())) 886.FirstOrDefault(a => a.AttributeClass.IsCollectionBuilderAttribute());
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (4)
29attributes.OrderBy(a => a.AttributeClass?.Name) 41attributes.OrderBy(a => a.AttributeClass?.Name) 75if (attribute.AttributeClass == null) 79return attribute.AttributeClass.GenerateTypeSyntax() is NameSyntax nameSyntax
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenOverridingAndHiding.cs (1)
4143var paramArrayAttributes = allAttributes.Where(a => a.AttributeClass.ToTestDisplayString() == "System.ParamArrayAttribute");
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (48)
Attributes\AttributeTests.cs (7)
1432switch (a.AttributeClass.Name) 1467Assert.Equal("Unexpected Attr", a.AttributeClass.Name); 2925Assert.Equal(1, endInvokeMethod.GetReturnTypeAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, returnTypeAttrType, TypeCompareKind.ConsiderEverything2)).Count()); 4020attrs = setter.GetReturnTypeAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, attributeTypeForReturn, TypeCompareKind.ConsiderEverything2)); 4033attrs = getter.GetReturnTypeAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, attributeTypeForReturn, TypeCompareKind.ConsiderEverything2)); 5092Assert.Equal(1, gooMethod.GetReturnTypeAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, b1Class, TypeCompareKind.ConsiderEverything2)).Count()); 5093Assert.Equal(1, gooMethod.GetReturnTypeAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, b2Class, TypeCompareKind.ConsiderEverything2)).Count());
Attributes\AttributeTests_Assembly.cs (9)
1023.Where(a => string.Equals(a.AttributeClass.Name, attrTypeName, StringComparison.Ordinal)); 1087switch (a.AttributeClass.Name) 1102Assert.Equal("Unexpected Attr", a.AttributeClass.Name); 1208switch (a.AttributeClass.Name) 1217Assert.Equal("Unexpected Attr", a.AttributeClass.Name); 1287switch (a.AttributeClass.Name) 1302Assert.Equal("Unexpected Attr", a.AttributeClass.Name); 1381switch (a.AttributeClass.Name) 1399Assert.Equal("Unexpected Attr", a.AttributeClass.Name);
Attributes\AttributeTests_Conditional.cs (2)
211Where(a => a.AttributeClass.Name != "CompilerGeneratedAttribute"). 212Select(a => a.AttributeClass.Name);
Attributes\AttributeTests_Dynamic.cs (1)
521var synthesizedDynamicAttributes = attributes.Where((attr) => string.Equals(attr.AttributeClass.Name, "DynamicAttribute", StringComparison.Ordinal));
Attributes\AttributeTests_IsByRefLike.cs (2)
1077Assert.NotEqual("IsByRefLikeAttribute", attr.AttributeClass.Name); 1095var attributes = typeSymbol.GetAttributes().OrderBy(attribute => attribute.AttributeClass.Name).ToArray();
Attributes\AttributeTests_NativeInteger.cs (3)
1496var field = attribute.AttributeClass.GetField("TransformFlags"); 1625var actualNames = attributes.Select(a => a.AttributeClass.ToTestDisplayString()).ToArray(); 1642return attributes.Single(a => a.AttributeClass.ToTestDisplayString() == "System.Runtime.CompilerServices.NativeIntegerAttribute");
Attributes\AttributeTests_Nullable.cs (4)
578var attributeType = attribute.AttributeClass; 5001var field = nullable.AttributeClass.GetField("NullableFlags"); 5385var actualNames = attributes.Select(a => a.AttributeClass.ToTestDisplayString()).ToArray(); 5403return attributes.Single(a => a.AttributeClass.ToTestDisplayString() == "System.Runtime.CompilerServices.NullableAttribute");
Attributes\AttributeTests_ReadOnlyStruct.cs (2)
646Assert.NotEqual("IsReadOnlyAttribute", attr.AttributeClass.Name); 662var attributes = typeSymbol.GetAttributes().OrderBy(attribute => attribute.AttributeClass.Name).ToArray();
Attributes\AttributeTests_RefReadOnly.cs (1)
2554var attributes = typeSymbol.GetAttributes().OrderBy(attribute => attribute.AttributeClass.Name).ToArray();
Attributes\AttributeTests_Security.cs (1)
61Assert.Equal(hostProtectionAttr, typeAttribute.AttributeClass);
Attributes\AttributeTests_Synthesized.cs (4)
64Assert.Equal("System.Runtime.CompilerServices.CompilationRelaxationsAttribute", attribute.AttributeClass.ToTestDisplayString()); 75Assert.Equal("System.Runtime.CompilerServices.RuntimeCompatibilityAttribute", attribute.AttributeClass.ToTestDisplayString()); 92Assert.Equal("System.Diagnostics.DebuggableAttribute", attribute.AttributeClass.ToTestDisplayString()); 405var dd = anon.GetAttributes().Where(a => a.AttributeClass.Name == "DebuggerDisplayAttribute").Single();
Attributes\AttributeTests_Tuples.cs (2)
618var synthesizedTupleElementNamesAttr = attributes.Where(attr => string.Equals(attr.AttributeClass.Name, "TupleElementNamesAttribute", StringComparison.Ordinal)); 628Assert.Equal("System.Runtime.CompilerServices.TupleElementNamesAttribute", tupleAttr.AttributeClass.ToTestDisplayString());
Attributes\WellKnownAttributesTestBase.cs (1)
94var paramArrayAttributes = allAttributes.Where(a => a.AttributeClass.ToTestDisplayString() == "System.ParamArrayAttribute");
Semantics\CollectionExpressionTests.cs (2)
13984a => Assert.Equal("System.Runtime.CompilerServices.CompilerGeneratedAttribute", a.AttributeClass?.ToTestDisplayString())); 13986m => m.GetAttributes().Any(a => a.AttributeClass?.ToTestDisplayString() == "System.Runtime.CompilerServices.CompilerGeneratedAttribute"));
Semantics\RecordTests.cs (7)
25106return GetAttributeStrings(symbol.GetAttributes().Where(a => a.AttributeClass!.Name is "A" or "B" or "C" or "D")); 25168switch (a.AttributeClass!.Name) 25245switch (a.AttributeClass!.Name) 25306switch (a.AttributeClass!.Name) 25387switch (a.AttributeClass!.Name) 25471switch (a.AttributeClass!.Name) 25535switch (a.AttributeClass!.Name)
Microsoft.CodeAnalysis.CSharp.Features (3)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
172if (invokedMethod.GetAttributes().Any(a => Equals(a.AttributeClass, conditionalAttributeType)))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
329if (namedType.GetAttributes().Any(a => a.AttributeClass.IsCollectionBuilderAttribute())) 886.FirstOrDefault(a => a.AttributeClass.IsCollectionBuilderAttribute());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (16)
Semantics\LocalFunctionTests.cs (9)
557Assert.Equal(aAttribute, attributeData.AttributeClass.GetSymbol()); 821Assert.Equal(aAttribute, attributeData.AttributeClass.GetSymbol()); 858Assert.Equal(comp.GetTypeByMetadataName("A"), attr.AttributeClass.GetSymbol()); 976Assert.Equal(comp.GetTypeByMetadataName("PropAttribute"), attributes[0].AttributeClass.GetSymbol()); 977Assert.Equal(comp.GetTypeByMetadataName("ReturnAttribute"), attributes[1].AttributeClass.GetSymbol()); 978Assert.Equal(comp.GetTypeByMetadataName("MethodAttribute"), attributes[2].AttributeClass.GetSymbol()); 982Assert.Equal(comp.GetTypeByMetadataName("PropAttribute"), returnAttributes[0].AttributeClass.GetSymbol()); 983Assert.Equal(comp.GetTypeByMetadataName("ReturnAttribute"), returnAttributes[1].AttributeClass.GetSymbol()); 984Assert.Equal(comp.GetTypeByMetadataName("MethodAttribute"), returnAttributes[2].AttributeClass.GetSymbol());
Semantics\NullableReferenceTypesTests.cs (6)
98806Assert.Same(m, nullableAttribute.AttributeClass.ContainingModule); 98807Assert.Equal(Accessibility.Internal, nullableAttribute.AttributeClass.DeclaredAccessibility); 98879Assert.NotEqual(m, nullableAttribute.AttributeClass.ContainingModule); 104931Assert.Same(m, nullableAttribute.AttributeClass.ContainingModule); 104932Assert.Equal(Accessibility.Internal, nullableAttribute.AttributeClass.DeclaredAccessibility); 105008Assert.NotEqual(m, nullableAttribute.AttributeClass.ContainingModule);
Semantics\RecordStructTests.cs (1)
10520return GetAttributeStrings(symbol.GetAttributes().Where(a => a.AttributeClass!.Name is "A" or "B" or "C" or "D"));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (6)
Symbols\Metadata\PE\LoadingAttributes.cs (1)
212Assert.Equal(aNestedAttribute, ((CSharpAttributeData)innerC1.GetAttributes(aNestedAttribute).Single()).AttributeClass);
Symbols\Retargeting\RetargetCustomAttributes.cs (5)
128TestAttributeRetargeting(symbol.GetReturnTypeAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, newMsCorLib_debuggerTypeProxyAttributeType, TypeCompareKind.ConsiderEverything2))); 131Assert.Empty(symbol.GetReturnTypeAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, oldMsCorLib_debuggerTypeProxyAttributeType, TypeCompareKind.ConsiderEverything2))); 147Assert.Same(newMsCorLib_debuggerTypeProxyAttributeType, attribute.AttributeClass); 352Assert.IsAssignableFrom<MissingMetadataTypeSymbol>(a.AttributeClass); 394Assert.False(a.AttributeClass.IsErrorType());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (9)
AttributeValidation.cs (3)
30var isUnmanagedTypeAttributes = attributeType.GetAttributes().OrderBy(attribute => attribute.AttributeClass.Name).ToArray(); 33Assert.Equal(WellKnownTypes.GetMetadataName(WellKnownType.System_Runtime_CompilerServices_CompilerGeneratedAttribute), isUnmanagedTypeAttributes[0].AttributeClass.ToDisplayString()); 34Assert.Equal(AttributeDescription.CodeAnalysisEmbeddedAttribute.FullName, isUnmanagedTypeAttributes[1].AttributeClass.ToDisplayString());
CSharpTestBase.cs (2)
1787return attributes.Select(a => a.AttributeClass.Name); 1792return attributes.Select(a => a.AttributeClass.Name);
Extensions.cs (2)
366return @this.GetAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, c, TypeCompareKind.ConsiderEverything2)); 381return @this.GetAttributes().Where(a => TypeSymbol.Equals(a.AttributeClass, c, TypeCompareKind.ConsiderEverything2)).First();
TestAttributesVisitor.cs (2)
159Assert.NotNull(attribute.AttributeClass); 160var name = attribute.AttributeClass!.Name;
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (4)
29attributes.OrderBy(a => a.AttributeClass?.Name) 41attributes.OrderBy(a => a.AttributeClass?.Name) 75if (attribute.AttributeClass == null) 79return attribute.AttributeClass.GenerateTypeSyntax() is NameSyntax nameSyntax
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
CodeGeneration\CodeGenerationTests.cs (1)
555var attribute = attributeTarget.GetAttributes().Single(attr => Equals(attr.AttributeClass, attributeType));
Microsoft.CodeAnalysis.Features (10)
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (1)
110.Select(data => data.AttributeClass)
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
320var attribute = type.GetAttributes().FirstOrDefault(d => IsDesignerAttribute(d.AttributeClass));
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
467if (attribute.AttributeClass is not
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (2)
91useDecompiler = !symbol.ContainingAssembly.GetAttributes().Any(static attribute => attribute.AttributeClass?.Name == nameof(SuppressIldasmAttribute) 92&& attribute.AttributeClass.ToNameDisplayString() == typeof(SuppressIldasmAttribute).FullName);
MetadataAsSource\MetadataAsSourceHelpers.cs (2)
109if (attribute.AttributeClass?.Name == nameof(ReferenceAssemblyAttribute) && 110attribute.AttributeClass.ToNameDisplayString() == typeof(ReferenceAssemblyAttribute).FullName)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
831if (suppressMessageAttributeType.Equals(attribute.AttributeClass) &&
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
710if (attribute.AttributeClass == _debuggerDisplayAttributeType &&
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
309if (!containingType.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, interpolatedStringHandlerAttributeType)))
Microsoft.CodeAnalysis.VisualBasic (1)
Errors\MessageProvider.vb (1)
484diagnostics.Add(ERRID.ERR_BadAttribute1, node.ArgumentList.Arguments(parameterIndex).GetLocation(), attribute.AttributeClass)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\AttributeGenerator.vb (1)
37attribute.AttributeClass.GenerateTypeSyntax(),
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (8)
Attributes\AssemblyAttributes.vb (8)
1313Select Case a.AttributeClass.Name 1327Assert.Equal("Unexpected Attr", a.AttributeClass.Name) 1430Select Case a.AttributeClass.Name 1438Assert.Equal("Unexpected Attr", a.AttributeClass.Name) 1503Select Case a.AttributeClass.Name 1517Assert.Equal("Unexpected Attr", a.AttributeClass.Name) 1602Select Case a.AttributeClass.Name 1616Assert.Equal("Unexpected Attr", a.AttributeClass.Name)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\AttributeGenerator.vb (1)
37attribute.AttributeClass.GenerateTypeSyntax(),
Microsoft.CodeAnalysis.Workspaces (17)
Editing\SyntaxGenerator.cs (2)
1022Contract.ThrowIfNull(attribute.AttributeClass); 1029name: this.TypeExpression(attribute.AttributeClass),
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
248var attrType = attr.AttributeClass;
Shared\Extensions\ISymbolExtensions.cs (1)
118if (Equals(attribute.AttributeClass, hideModuleNameAttribute))
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
38if (generatedCodeAttribute.Equals(attribute.AttributeClass))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IMethodSymbolExtensions.cs (1)
123method.ReturnType.GetAttributes().Any(a => a.AttributeClass?.Equals(compilation.AsyncMethodBuilderAttribute()) ?? false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
794=> symbol.GetAttributes().Any(static x => x.AttributeClass is
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (3)
713if (attributeData.AttributeClass?.Name == nameof(ReferenceAssemblyAttribute) 714&& attributeData.AttributeClass.ToNameDisplayString() == typeof(ReferenceAssemblyAttribute).FullName) 764namedType.OriginalDefinition.GetAttributes().Any(static a => a.AttributeClass?.SpecialType == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
47AttributeClass.Name: "InterceptsLocationAttribute",
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
399=> attribute.AttributeClass is
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
168=> GetAttributes().WhereAsArray(a => a.AttributeClass.Equals(attributeType));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (2)
175=> arg.removeAttributeTypes.Any(attr => attr.Equals(a.AttributeClass)) || 176a.AttributeClass?.IsAccessibleWithin(arg.accessibleWithin) == false;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (2)
70=> arg.attributesToRemove.Any(attr => attr.Equals(a.AttributeClass)) || 71a.AttributeClass?.IsAccessibleWithin(arg.accessibleWithin) == false;
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (4)
VisualStudioMSBuildWorkspaceTests.cs (4)
1907Assert.Contains(attrs, ad => ad.AttributeClass.Name == "MyAttribute"); 1930Assert.DoesNotContain(attrs, ad => ad.AttributeClass.Name == "MyAttribute"); 1954Assert.Contains(attrs, ad => ad.AttributeClass.Name == "MyAttr"); 1977Assert.DoesNotContain(attrs, ad => ad.AttributeClass.Name == "MyAttr");
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
129if (!SymbolEqualityComparer.Default.Equals(attributeData.AttributeClass, loggerMessageAttribute))
Microsoft.Extensions.Options.SourceGeneration (7)
Parser.cs (6)
350foreach (var attribute in member.GetAttributes().Where(a => a.AttributeClass is not null)) 352var attributeType = attribute.AttributeClass!; 624_optionsSourceGenContext.EnsureTrackingAttribute(attribute.AttributeClass!.Name, createValue: true, out HashSet<object>? trackedTypeList); 626attributeFullQualifiedName = $"{Emitter.StaticGeneratedValidationAttributesClassesNamespace}.{Emitter.StaticAttributeClassNamePrefix}{_optionsSourceGenContext.Suffix}_{attribute.AttributeClass!.Name}"; 679_optionsSourceGenContext.EnsureTrackingAttribute(attribute.AttributeClass!.Name, createValue: hasTimeSpanType, out _); 680attributeFullQualifiedName = $"{Emitter.StaticGeneratedValidationAttributesClassesNamespace}.{Emitter.StaticAttributeClassNamePrefix}{_optionsSourceGenContext.Suffix}_{attribute.AttributeClass!.Name}";
ParserUtilities.cs (1)
24if (SymbolEqualityComparer.Default.Equals(attribute, item.AttributeClass) && item.AttributeConstructor != null)
Microsoft.Gen.ComplianceReports (3)
Parser.cs (3)
209if (SymbolEqualityComparer.Default.Equals(_symbolHolder.LoggerMessageAttribute, a.AttributeClass)) 255if (DerivesFrom(attribute.AttributeClass!, _symbolHolder.DataClassificationAttributeSymbol)) 257string name = attribute.AttributeClass!.Name;
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)
473.Select(static attribute => attribute.AttributeClass)
src\Generators\Shared\ParserUtilities.cs (1)
29if (SymbolEqualityComparer.Default.Equals(attribute, item.AttributeClass) && item.AttributeConstructor != null)
Microsoft.Gen.Metrics (2)
Parser.cs (1)
400var (instrumentKind, genericType) = GetInstrumentType(methodAttribute.AttributeClass, symbols);
src\Generators\Shared\ParserUtilities.cs (1)
29if (SymbolEqualityComparer.Default.Equals(attribute, item.AttributeClass) && item.AttributeConstructor != null)
Microsoft.Gen.MetricsReports (2)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (1)
400var (instrumentKind, genericType) = GetInstrumentType(methodAttribute.AttributeClass, symbols);
src\Generators\Shared\ParserUtilities.cs (1)
29if (SymbolEqualityComparer.Default.Equals(attribute, item.AttributeClass) && item.AttributeConstructor != null)
Microsoft.Interop.ComInterfaceGenerator (32)
Analyzers\AddGeneratedComClassAnalyzer.cs (3)
36if (type.GetAttributes().Any(attr => generatedComClassAttributeType.Equals(attr.AttributeClass, SymbolEqualityComparer.Default))) 49if (iface.GetAttributes().Any(attr => generatedComInterfaceAttributeType.Equals(attr.AttributeClass, SymbolEqualityComparer.Default))) 57&& type.BaseType.GetAttributes().Any(attr => generatedComClassAttributeType.Equals(attr.AttributeClass, SymbolEqualityComparer.Default)))
Analyzers\ComHostingDoesNotSupportGeneratedComInterfaceAnalyzer.cs (2)
53if (containingType.GetAttributes().Any(attr => generatedComClassAttribute.Equals(attr.AttributeClass, SymbolEqualityComparer.Default))) 61if (iface.GetAttributes().Any(attr => generatedComInterfaceAttribute.Equals(attr.AttributeClass, SymbolEqualityComparer.Default)))
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (2)
51AttributeData? interfaceTypeAttributeData = type.GetAttributes().FirstOrDefault(a => a.AttributeClass.Equals(interfaceTypeAttribute, SymbolEqualityComparer.Default)); 76AttributeData comImportAttribute = type.GetAttributes().First(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_InteropServices_ComImportAttribute);
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (1)
99var comImportAttribute = await declaringType.GetAttributes().First(attr => attr.AttributeClass.Equals(comImportAttributeType, SymbolEqualityComparer.Default)).ApplicationSyntaxReference.GetSyntaxAsync(ct).ConfigureAwait(false);
Analyzers\GeneratedComInterfaceAttributeAnalyzer.cs (1)
80if (attr.AttributeClass?.ToDisplayString() == attributeDisplayName)
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)));
AttributeInfo.cs (1)
27var type = ManagedTypeInfo.CreateTypeInfoForTypeSymbol(attribute.AttributeClass);
ComClassInfo.cs (1)
45AttributeData? generatedComInterfaceAttribute = iface.GetAttributes().FirstOrDefault(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute);
ComInterfaceGenerator.cs (3)
248if (lcidConversionAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, lcidConversionAttrType)) 252else if (suppressGCTransitionAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, suppressGCTransitionAttrType)) 256else if (unmanagedCallConvAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, unmanagedCallConvAttrType))
ComInterfaceInfo.cs (2)
299if (attr.AttributeClass?.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute) 333var attrDisplayString = attr.AttributeClass?.ToDisplayString();
GeneratedComInterfaceAttributeData.cs (2)
45&& attr.AttributeClass?.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute) 62Debug.Assert(attr.AttributeClass.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (3)
245&& !parameter.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 254&& !methodSymbol.GetReturnTypeAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 275&& !methodSymbol.GetReturnTypeAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute))
VtableIndexStubGenerator.cs (9)
133if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error) 212if (attr.AttributeClass is not null 213&& attr.AttributeClass.ToDisplayString() == TypeNames.VirtualMethodIndexAttribute) 217else if (lcidConversionAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, lcidConversionAttrType)) 221else if (suppressGCTransitionAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, suppressGCTransitionAttrType)) 225else if (unmanagedCallConvAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, unmanagedCallConvAttrType)) 300var unmanagedObjectUnwrapper = symbol.ContainingType.GetAttributes().FirstOrDefault(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)); 305var unwrapperSyntax = ParseTypeName(unmanagedObjectUnwrapper.AttributeClass.TypeArguments[0].ToDisplayString()); 419if (!method.ContainingType.GetAttributes().Any(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)))
Microsoft.Interop.JavaScript.JSImportGenerator (7)
JSExportGenerator.cs (3)
161if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error) 180if (attr.AttributeClass is not null 181&& attr.AttributeClass.ToDisplayString() == Constants.JSExportAttribute)
JSImportGenerator.cs (3)
133if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error) 160if (attr.AttributeClass is not null 161&& attr.AttributeClass.ToDisplayString() == Constants.JSImportAttribute)
JSMarshalAsAttributeInfoParser.cs (1)
26INamedTypeSymbol? jsTypeArgs = attributeData.AttributeClass.TypeArguments[0] as INamedTypeSymbol;
Microsoft.Interop.LibraryImportGenerator (17)
Analyzers\ConvertToLibraryImportAnalyzer.cs (4)
123if (SymbolEqualityComparer.Default.Equals(attr.AttributeClass, libraryImportAttrType)) 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)
664if (SymbolEqualityComparer.Default.Equals(attrLocal.AttributeClass, attributeType))
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
61attr => attr.AttributeClass?.ToDisplayString() == TypeNames.CustomMarshallerAttribute
LibraryImportGenerator.cs (8)
190if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error) 240if (attr.AttributeClass is not null 241&& attr.AttributeClass.ToDisplayString() == TypeNames.LibraryImportAttribute) 245else if (lcidConversionAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, lcidConversionAttrType)) 249else if (suppressGCTransitionAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, suppressGCTransitionAttrType)) 253else if (unmanagedCallConvAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, unmanagedCallConvAttrType)) 257else if (defaultDllImportSearchPathsAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, defaultDllImportSearchPathsAttrType)) 261else if (wasmImportLinkageAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, wasmImportLinkageAttrType))
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (3)
245&& !parameter.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 254&& !methodSymbol.GetReturnTypeAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 275&& !methodSymbol.GetReturnTypeAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute))
Microsoft.Interop.LibraryImportGenerator.Downlevel (5)
DownlevelLibraryImportGenerator.cs (5)
132if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error) 175if (attr.AttributeClass is not null 176&& attr.AttributeClass.ToDisplayString() == TypeNames.LibraryImportAttribute) 180else if (lcidConversionAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, lcidConversionAttrType)) 184else if (defaultDllImportSearchPathsAttrType is not null && SymbolEqualityComparer.Default.Equals(attr.AttributeClass, defaultDllImportSearchPathsAttrType))
Microsoft.Interop.SourceGeneration (18)
CompilationExtensions.cs (2)
17if (compilation.SourceModule.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_CompilerServices_SkipLocalsInitAttribute)) 21if (compilation.SourceModule.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_CompilerServices_DisableRuntimeMarshallingAttribute))
IncrementalGeneratorInitializationContextExtensions.cs (1)
37(context, ct) => SymbolEqualityComparer.Default.Equals(context.Attributes[0].AttributeClass.ContainingAssembly, context.SemanticModel.Compilation.GetSpecialType(SpecialType.System_Object).ContainingAssembly))
ManualTypeMarshallingHelper.cs (3)
86&& entryPointType.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.ContiguousCollectionMarshallerAttribute); 91return entryPointType.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.CustomMarshallerAttribute); 155var attrs = entryPointType.GetAttributes().Where(attr => attr.AttributeClass.ToDisplayString() == TypeNames.CustomMarshallerAttribute).ToArray();
MarshalAsParser.cs (2)
179_diagnostics.ReportConfigurationNotSupported(attributeData, $"{attributeData.AttributeClass!.Name}{Type.Delimiter}{namedArg.Key}"); 184_diagnostics.ReportConfigurationNotSupported(attributeData, $"{attributeData.AttributeClass!.Name}{Type.Delimiter}{namedArg.Key}");
MarshallingInfoParser.cs (1)
261if (attribute.AttributeConstructor is not null && parser.CanParseAttributeType(attribute.AttributeClass))
MarshalUsingAttributeParser.cs (1)
30Debug.Assert(attributeData.AttributeClass!.ToDisplayString() == TypeNames.MarshalUsingAttribute);
NativeMarshallingAttributeParser.cs (1)
24Debug.Assert(attributeData.AttributeClass!.ToDisplayString() == TypeNames.NativeMarshallingAttribute);
SignatureContext.cs (1)
173=> a.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_CompilerServices_SkipLocalsInitAttribute;
TypePositionInfo.cs (2)
127if (SymbolEqualityComparer.Default.Equals(attr.AttributeClass, outAttributeType)) 132else if (SymbolEqualityComparer.Default.Equals(attr.AttributeClass, inAttributeType))
TypeSymbolExtensions.cs (3)
122if (attr.AttributeClass is null) 126else if (attr.AttributeClass.ToDisplayString() == "System.Runtime.InteropServices.NativeMarshallingAttribute") 139if (attr.AttributeClass.ToDisplayString() == "System.Runtime.InteropServices.StructLayoutAttribute")
UseSiteAttributeProvider.cs (1)
64if (attribute.AttributeConstructor is not null && parser.CanParseAttributeType(attribute.AttributeClass))
Microsoft.ML.InternalCodeAnalyzer (6)
BestFriendAnalyzer.cs (2)
99assemblyWantsBestFriends = symbolAssembly.GetAttributes().Any(a => Equals(a.AttributeClass, wantsToBeBestFriendsAttributeType)); 104if (symbol.GetAttributes().Any(a => Equals(a.AttributeClass, bestFriendAttributeType)))
BestFriendOnPublicDeclarationsAnalyzer.cs (1)
62var attribute = context.Symbol.GetAttributes().FirstOrDefault(a => Equals(a.AttributeClass, attributeType));
ContractsCheckNameofFixProvider.cs (1)
143AttributeData attr = s.GetAttributes().FirstOrDefault(a => a.AttributeClass.Name == "ArgumentAttribute");
IMethodSymbolExtensions.cs (1)
16if (attribute.AttributeClass.IsTestAttribute(knownTestAttributes, factAttribute))
InstanceInitializerAnalyzer.cs (1)
49if (symbol.GetAttributes().Any(i => i.AttributeClass.Name == "ArgumentAttribute"))
Mvc.Analyzers.Test (7)
CodeAnalysisExtensionsTest.cs (7)
317Assert.Same(attribute, attributeData.AttributeClass); 322Assert.Same(attribute, attributeData.AttributeClass); 360Assert.Same(attribute, attributeData.AttributeClass); 365Assert.Same(attribute, attributeData.AttributeClass); 370Assert.Same(attribute, attributeData.AttributeClass); 408Assert.Same(attribute, attributeData.AttributeClass); 446Assert.Same(attribute, attributeData.AttributeClass);
System.Private.CoreLib.Generators (5)
EventSourceGenerator.Parser.cs (2)
37if (attribute.AttributeClass?.Name != "EventSourceAttribute" || 38attribute.AttributeClass.ToDisplayString() != EventSourceAttribute)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (3)
173if (attributeData.AttributeClass.Equals(bypassReadyToRunAttribute, SymbolEqualityComparer.Default)) 386if (attributeData.AttributeClass.Equals(compExactlyDependsOn, SymbolEqualityComparer.Default)) 519if (attributeData.AttributeClass.Equals(compExactlyDependsOn, SymbolEqualityComparer.Default))
System.Text.Json.SourceGeneration (12)
Helpers\RoslynExtensions.cs (3)
120=> attributeType != null && memberInfo.GetAttributes().Any(attr => SymbolEqualityComparer.Default.Equals(attr.AttributeClass, attributeType)); 380attr.AttributeClass?.Name == attributeName && 381attr.AttributeClass.ContainingNamespace.ToDisplayString() == "System.Diagnostics.CodeAnalysis");
JsonSourceGenerator.Parser.cs (6)
242INamedTypeSymbol? attributeClass = attributeData.AttributeClass; 701INamedTypeSymbol? attributeType = attributeData.AttributeClass; 1256INamedTypeSymbol? attributeType = attributeData.AttributeClass; 1564Debug.Assert(_knownSymbols.JsonConverterAttributeType.IsAssignableFrom(attributeData.AttributeClass)); 1566if (!SymbolEqualityComparer.Default.Equals(attributeData.AttributeClass, _knownSymbols.JsonConverterAttributeType)) 1568ReportDiagnostic(DiagnosticDescriptors.DerivedJsonConverterAttributesNotSupported, attributeData.GetLocation(), attributeData.AttributeClass!.ToDisplayString());
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithMetadataName.cs (3)
38/// these attributes will have an <see cref="AttributeData.AttributeClass"/> whose fully qualified name metadata 86/// <see cref="AttributeData.AttributeClass"/> has the same fully qualified, metadata name as <paramref 193attribute.AttributeClass?.ToDisplayString(/*s_metadataDisplayFormat*/) == fullyQualifiedMetadataName)
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
49.Any(a => a?.AttributeClass?.Name is (nameof(DesignerSerializationVisibilityAttribute))
System.Windows.Forms.PrivateSourceGenerators (1)
System\Windows\Forms\SourceGenerators\EnumValidationGenerator.cs (1)
226bool isFlags = enumType.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, flagsAttributeType));