diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs index 55caff9d..6981fdc5 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs @@ -27,7 +27,7 @@ public sealed class InvalidD2DResourceTextureIndexUseAnalyzer : DiagnosticAnalyz { IFieldSymbol fieldSymbol = (IFieldSymbol)context.Symbol; - if (fieldSymbol.HasAttributeWithFullyQualifiedName("ComputeSharp.D2D1.D2DResourceTextureIndexAttribute")) + if (fieldSymbol.TryGetAttributeWithFullMetadataName("ComputeSharp.D2D1.D2DResourceTextureIndexAttribute", out _)) { string metadataName = fieldSymbol.Type.GetFullMetadataName(); diff --git a/src/ComputeSharp.SourceGeneration/Extensions/ISymbolExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/ISymbolExtensions.cs index aff9648f..d402f5f0 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/ISymbolExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/ISymbolExtensions.cs @@ -140,25 +140,6 @@ internal static class ISymbolExtensions return $"{symbol.ContainingType.GetFullMetadataName()}.{symbol.Name}"; } - /// - /// Checks whether or not a given symbol has an attribute with the specified full name. - /// - /// The input instance to check. - /// The attribute name to look for. - /// Whether or not has an attribute with the specified name. - public static bool HasAttributeWithFullyQualifiedName(this ISymbol symbol, string name) - { - foreach (AttributeData attribute in symbol.GetAttributes()) - { - if (attribute.AttributeClass?.HasFullyQualifiedName(name) == true) - { - return true; - } - } - - return false; - } - /// /// Tries to get an attribute with the specified full metadata name. ///