diff --git a/src/Features/CSharp/Portable/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.cs b/src/Features/CSharp/Portable/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.cs index 5df40e66890557bd44b1decb558fe1734b0267ef..3e0982ec80b934693d4854ee807e808b64752323 100644 --- a/src/Features/CSharp/Portable/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.cs +++ b/src/Features/CSharp/Portable/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.cs @@ -59,6 +59,8 @@ protected override void InitializeWorker(AnalysisContext context) var cancellationToken = context.CancellationToken; var invocation = (IInvocationOperation)context.Operation; + // Validate we're on a piece of syntax we expect. While not necessary for analysis, we + // want to make sure we're on something the fixer will know how to actually fix. var invocationSyntax = invocation.Syntax as InvocationExpressionSyntax; if (invocationSyntax is null || invocationSyntax.ArgumentList is null)