private static void AnalyzeInvocationOp(OperationAnalysisContext context) { var statement = (IExpressionStatementOperation)context.Operation; var invocation = statement.Operation as IInvocationOperation; if (invocation == null) { return; } if (!IsCodeContractToRemove(context.Compilation, invocation)) { return; } if (ContractStatementAnalyzer.IsInvariantMethod(context.ContainingSymbol) || ContractStatementAnalyzer.IsContractClass(context.ContainingSymbol)) { return; } var invocationSyntax = (InvocationExpressionSyntax)invocation.Syntax; if (invocationSyntax.Expression is MemberAccessExpressionSyntax memberAccess) { context.ReportDiagnostic(Diagnostic.Create(Rule, statement.Syntax.GetLocation())); } }