Skip to content

Commit 70e7c92

Browse files
committed
C#: Also check the namespace of the InlineArrayAttribute.
1 parent 674838e commit 70e7c92

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,11 @@ public static bool IsUnboundReadOnlySpan(this ITypeSymbol type) =>
527527
public static bool IsInlineArray(this ITypeSymbol type)
528528
{
529529
var attributes = type.GetAttributes();
530-
var isInline = attributes.Any(attribute => attribute.AttributeClass?.Name == "InlineArrayAttribute");
530+
var isInline = attributes.Any(attribute =>
531+
attribute.AttributeClass is INamedTypeSymbol nt &&
532+
nt.Name == "InlineArrayAttribute" &&
533+
nt.ContainingNamespace.ToString() == "System.Runtime.CompilerServices"
534+
);
531535
return isInline;
532536
}
533537

0 commit comments

Comments
 (0)