diff --git a/src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/ClientMethodsAnalyzer.cs b/src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/ClientMethodsAnalyzer.cs index 6b23a0c5110..97694829f49 100644 --- a/src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/ClientMethodsAnalyzer.cs +++ b/src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/ClientMethodsAnalyzer.cs @@ -142,7 +142,7 @@ public override void AnalyzeCore(ISymbolAnalysisContext context) foreach (var member in type.GetMembers()) { var methodSymbol = member as IMethodSymbol; - if (methodSymbol.DeclaredAccessibility != Accessibility.Public) + if (methodSymbol == null || methodSymbol.DeclaredAccessibility != Accessibility.Public) { continue; }