diff --git a/Design/Rule0028CodeNavigabilityOnEventSubscribers.cs b/Design/Rule0028CodeNavigabilityOnEventSubscribers.cs index 203594d1..26418fef 100644 --- a/Design/Rule0028CodeNavigabilityOnEventSubscribers.cs +++ b/Design/Rule0028CodeNavigabilityOnEventSubscribers.cs @@ -22,7 +22,9 @@ private void CodeNavigabilityOnEventSubscribers(CodeBlockAnalysisContext context if (context.OwningSymbol.GetContainingObjectTypeSymbol().IsObsoletePending || context.OwningSymbol.GetContainingObjectTypeSymbol().IsObsoleteRemoved) return; if (context.OwningSymbol.IsObsoletePending || context.OwningSymbol.IsObsoleteRemoved) return; + if (!context.CodeBlock.IsKind(SyntaxKind.MethodDeclaration)) return; var SyntaxList = ((MethodDeclarationSyntax)context.CodeBlock).Attributes.Where(value => value.GetIdentifierOrLiteralValue().ToUpper() == "EVENTSUBSCRIBER"); + foreach (var Syntax in SyntaxList) { if (Syntax.ArgumentList.Arguments[2].IsKind(SyntaxKind.LiteralAttributeArgument))