Skip to content

Commit 13018f4

Browse files
committed
Feedback
1 parent ec72a16 commit 13018f4

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/Shared/RoslynUtils/SymbolExtensions.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,7 @@ public static bool HasAttributeInheritingFrom(this ISymbol symbol, INamedTypeSym
129129

130130
public static bool TryGetAttributeInheritingFrom(this ISymbol symbol, INamedTypeSymbol baseType, [NotNullWhen(true)] out AttributeData? matchedAttribute)
131131
{
132-
foreach (var attributeData in symbol.GetAttributes())
133-
{
134-
if (attributeData.AttributeClass is not null && attributeData.AttributeClass.InheritsFrom(baseType))
135-
{
136-
matchedAttribute = attributeData;
137-
return true;
138-
}
139-
}
140-
141-
matchedAttribute = null;
142-
return false;
132+
return symbol.GetAttributes().TryGetAttributeInheritingFrom(baseType, out matchedAttribute);
143133
}
144134

145135
public static bool HasAttributeInheritingFrom(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol baseType)

src/SignalR/server/Core/src/Internal/HubMethodDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public HubMethodDescriptor(ObjectMethodExecutor methodExecutor, IServiceProvider
8888
markedParameter = true;
8989
MarkServiceParameter(index);
9090
}
91-
else if (typeof(FromKeyedServicesAttribute).IsAssignableFrom(attribute.GetType()) && attribute is FromKeyedServicesAttribute keyedServicesAttribute)
91+
else if (attribute is FromKeyedServicesAttribute keyedServicesAttribute)
9292
{
9393
ThrowIfMarked(markedParameter);
9494
markedParameter = true;

0 commit comments

Comments
 (0)