291 references to Operation
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
57var invocation = (IInvocationOperation)context.Operation;
ILLink.RoslynAnalyzer (3)
COMAnalyzer.cs (2)
40 var invocationOperation = (IInvocationOperation) operationContext.Operation; 55 operationContext.Operation.Syntax.GetLocation (), targetMethod.GetDisplayName ()));
RequiresAnalyzerBase.cs (1)
204 var parent = operationContext.Operation.Parent;
Microsoft.Analyzers.Extra (9)
AsyncCallInsideUsingBlockAnalyzer.cs (2)
46var operation = (IUsingDeclarationOperation)analysisContext.Operation; 59var operation = (IUsingOperation)analysisContext.Operation;
CallAnalysis\CallAnalyzer.Handlers.cs (3)
23var op = (IInvocationOperation)context.Operation; 84var op = (IObjectCreationOperation)context.Operation; 102var op = (IPropertyReferenceOperation)context.Operation;
CoalesceAnalyzer.cs (2)
32var op = (ICoalesceAssignmentOperation)operationAnalysisContext.Operation; 59var op = (ICoalesceOperation)operationAnalysisContext.Operation;
ConditionalAccessAnalyzer.cs (1)
34var op = (IConditionalAccessOperation)operationAnalysisContext.Operation;
UsingToStringInLoggersAnalyzer.cs (1)
40var invocation = (IInvocationOperation)context.Operation;
Microsoft.Analyzers.Local (4)
CallAnalysis\CallAnalyzer.Handlers.cs (4)
23var op = (IInvocationOperation)context.Operation; 84var op = (IObjectCreationOperation)context.Operation; 102var op = (IPropertyReferenceOperation)context.Operation; 114var op = (IThrowOperation)context.Operation;
Microsoft.AspNetCore.Analyzers (3)
MiddlewareAnalyzer.cs (1)
33if (context.Operation is IInvocationOperation invocation &&
OptionsAnalyzer.cs (1)
27if (context.Operation is ISimpleAssignmentOperation operation &&
ServicesAnalyzer.cs (1)
28if (context.Operation is IInvocationOperation invocation &&
Microsoft.AspNetCore.App.Analyzers (8)
Authorization\AddAuthorizationBuilderAnalyzer.cs (1)
55var invocation = (IInvocationOperation)context.Operation;
Http\HeaderDictionaryAddAnalyzer.cs (1)
32var invocation = (IInvocationOperation)context.Operation;
Http\HeaderDictionaryIndexerAnalyzer.cs (1)
24var propertyReference = (IPropertyReferenceOperation)context.Operation;
Http\RequestDelegateReturnTypeAnalyzer.cs (2)
30var methodReference = (IMethodReferenceOperation)context.Operation; 46var anonymousFunction = (IAnonymousFunctionOperation)context.Operation;
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
32var invocation = (IInvocationOperation)context.Operation;
RouteHandlers\RouteHandlerAnalyzer.cs (1)
70var invocation = (IInvocationOperation)context.Operation;
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
74var invocation = (IInvocationOperation)context.Operation;
Microsoft.AspNetCore.Components.Analyzers (6)
ComponentParameterUsageAnalyzer.cs (2)
43if (context.Operation is IAssignmentOperation assignmentOperation) 49var incrementOrDecrementOperation = (IIncrementOrDecrementOperation)context.Operation;
InternalUsageAnalyzer.cs (4)
61var symbol = context.Operation switch 69_ => throw new InvalidOperationException("Unexpected operation kind: " + context.Operation.Kind), 139context.Operation.Syntax.GetLocation(), 149context.Operation.Syntax.GetLocation(),
Microsoft.AspNetCore.Components.SdkAnalyzers (6)
ComponentParameterUsageAnalyzer.cs (2)
43if (context.Operation is IAssignmentOperation assignmentOperation) 49var incrementOrDecrementOperation = (IIncrementOrDecrementOperation)context.Operation;
InternalUsageAnalyzer.cs (4)
61var symbol = context.Operation switch 69_ => throw new InvalidOperationException("Unexpected operation kind: " + context.Operation.Kind), 139context.Operation.Syntax.GetLocation(), 149context.Operation.Syntax.GetLocation(),
Microsoft.AspNetCore.Mvc.Analyzers (5)
AvoidHtmlPartialAnalyzer.cs (3)
23var method = ((IInvocationOperation)context.Operation).TargetMethod; 33context.Operation.Syntax.GetLocation(), 40context.Operation.Syntax.GetLocation(),
TagHelpersInCodeBlocksAnalyzer.cs (2)
46var awaitOperation = (IAwaitOperation)context.Operation; 60var parent = context.Operation.Parent;
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (1)
39var ifOperation = (IConditionalOperation)context.Operation;
ApiConventionAnalyzer.cs (1)
48var hasUnreadableStatusCodes = !ActualApiResponseMetadataFactory.TryGetActualResponseMetadata(symbolCache, (IMethodBodyOperation)context.Operation, out var actualResponseMetadata);
Microsoft.CodeAnalysis (4)
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (4)
1800/// Syntax tree for the <see cref="Operation"/> being analyzed. 1812/// Indicates if the <see cref="Operation"/> is generated code. 1873/// Gets a <see cref="ControlFlowGraph"/> for the operation block containing the <see cref="Operation"/>. 1875public ControlFlowGraph GetControlFlowGraph() => DiagnosticAnalysisContextHelpers.GetControlFlowGraph(Operation, _getControlFlowGraph, _cancellationToken);
Microsoft.CodeAnalysis.CodeStyle (32)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (2)
36if (!IsValidTypeofAction(context) || !IsValidOperation(context.Operation)) 41var node = context.Operation.Syntax;
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
97var fieldReference = (IFieldReferenceOperation)operationContext.Operation;
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
52var switchOperation = (TSwitchOperation)context.Operation;
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (3)
64switch (context.Operation) 73throw ExceptionUtilities.UnexpectedValue(context.Operation); 88if (context.Operation.Parent?.Kind == OperationKind.PropertySubpattern)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (4)
34var syntax = context.Operation.Syntax; 38var operation = (IIsPatternOperation)context.Operation; 56var syntax = context.Operation.Syntax; 61var operation = (IBinaryOperation)context.Operation;
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (8)
231var operation = context.Operation; 296var operation = operationContext.Operation; 310var initializer = (IFieldInitializerOperation)operationContext.Operation; 355var memberReference = (IMemberReferenceOperation)operationContext.Operation; 412var operation = operationContext.Operation; 424var targetMethod = ((IInvocationOperation)operationContext.Operation).TargetMethod.OriginalDefinition; 443var nameofArgument = ((INameOfOperation)operationContext.Operation).Argument; 461var constructor = ((IObjectCreationOperation)operationContext.Operation).Constructor?.OriginalDefinition;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (4)
169var expressionStatement = (IExpressionStatementOperation)context.Operation; 229_hasDelegateEscape = !IsHandledDelegateCreationOrAnonymousFunctionTreeShape(operationAnalysisContext.Operation); 235if (operationAnalysisContext.Operation is IParameterReferenceOperation parameterReference) 242_hasDelegateEscape = !IsHandledLocalOrParameterReferenceTreeShape(operationAnalysisContext.Operation);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
105var methodBinding = (IMethodReferenceOperation)context.Operation;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationDiagnosticAnalyzer.cs (1)
51var interpolation = (IInterpolationOperation)context.Operation;
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (2)
124if (context.Operation.Syntax.GetDiagnostics().Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Error)) 129if (context.Operation is not IInvocationOperation invocation)
src\Analyzers\Core\Analyzers\UseConditionalExpression\AbstractUseConditionalExpressionDiagnosticAnalyzer.cs (1)
43var ifOperation = (IConditionalOperation)context.Operation;
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
47var fieldReferenceOperation = (IFieldReferenceOperation)context.Operation;
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (2)
74var throwOperation = (IThrowOperation)context.Operation; 80var semanticModel = context.Operation.SemanticModel;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (1)
199=> context.Operation.Syntax.FindNode(context.FilterSpan, findInTrivia, getInnermostNodeForTie);
Microsoft.CodeAnalysis.CSharp.CodeStyle (15)
src\Analyzers\CSharp\Analyzers\ConvertTypeofToNameof\CSharpConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
26var node = context.Operation.Syntax;
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
102var operationAssigmnent = (IAssignmentOperation)context.Operation;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (3)
102var invocationOperation = (IInvocationOperation)context.Operation; 120var propertyReference = (IPropertyReferenceOperation)context.Operation; 142var arrayElementReference = (IArrayElementReferenceOperation)context.Operation;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
78var operation = context.Operation;
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (4)
61context.Operation.Syntax is not UnaryPatternSyntax) 66var negatedPattern = (INegatedPatternOperation)context.Operation; 81Descriptor, context.Operation.Syntax.GetLocation(), notificationOption, context.Options, additionalLocations: null, properties: null)); 87var operation = context.Operation;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
545var operation = (IMemberReferenceOperation)context.Operation;
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (2)
159var fieldInitializer = (IFieldInitializerOperation)context.Operation; 171var fieldReferenceOperation = (IFieldReferenceOperation)context.Operation;
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
62var arrayCreationOperation = (IArrayCreationOperation)context.Operation; 86var semanticModel = context.Operation.SemanticModel;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (26)
Diagnostics\DiagnosticAnalyzerTests.cs (3)
2330ReportOperationDiagnostics(operationContext.Operation, operationContext.ContainingSymbol.Name, operationContext.ReportDiagnostic); 3863context => context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Rule, context.Operation.Syntax.GetLocation())), 3869context => context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Rule, context.Operation.Syntax.GetLocation())),
Diagnostics\GetDiagnosticsTests.cs (1)
983context => analyzeNode(context.Operation.Syntax, context.ContainingSymbol, context.ReportDiagnostic),
Semantics\PrimaryConstructorTests.cs (13)
4328Assert.Equal(SyntaxKind.ClassDeclaration, context.Operation.Syntax.Kind()); 4332Assert.Equal(SyntaxKind.ClassDeclaration, context.Operation.Syntax.Kind()); 4336Assert.Equal(SyntaxKind.ConstructorDeclaration, context.Operation.Syntax.Kind()); 4350Assert.Equal(SyntaxKind.PrimaryConstructorBaseType, context.Operation.Syntax.Kind()); 4351VerifyOperationTree((CSharpCompilation)context.Compilation, context.Operation, 4365Assert.Equal(SyntaxKind.BaseConstructorInitializer, context.Operation.Syntax.Kind()); 4366VerifyOperationTree((CSharpCompilation)context.Compilation, context.Operation, 4386switch (context.Operation.Syntax.ToString()) 4432switch (context.Operation.Syntax.ToString()) 5696Assert.Equal(SyntaxKind.RecordDeclaration, context.Operation.Syntax.Kind()); 5697VerifyOperationTree((CSharpCompilation)context.Compilation, context.Operation, @""); 5713switch (context.Operation.Syntax.ToString()) 5731switch (context.Operation.Syntax.ToString())
Semantics\RecordTests.cs (9)
26836Assert.Equal(SyntaxKind.RecordDeclaration, context.Operation.Syntax.Kind()); 26840Assert.Equal(SyntaxKind.RecordDeclaration, context.Operation.Syntax.Kind()); 26844Assert.Equal(SyntaxKind.ConstructorDeclaration, context.Operation.Syntax.Kind()); 26858Assert.Equal(SyntaxKind.PrimaryConstructorBaseType, context.Operation.Syntax.Kind()); 26859VerifyOperationTree((CSharpCompilation)context.Compilation, context.Operation, 26873Assert.Equal(SyntaxKind.BaseConstructorInitializer, context.Operation.Syntax.Kind()); 26874VerifyOperationTree((CSharpCompilation)context.Compilation, context.Operation, 26894switch (context.Operation.Syntax.ToString()) 26940switch (context.Operation.Syntax.ToString())
Microsoft.CodeAnalysis.CSharp.Features (15)
src\Analyzers\CSharp\Analyzers\ConvertTypeofToNameof\CSharpConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
26var node = context.Operation.Syntax;
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
102var operationAssigmnent = (IAssignmentOperation)context.Operation;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (3)
102var invocationOperation = (IInvocationOperation)context.Operation; 120var propertyReference = (IPropertyReferenceOperation)context.Operation; 142var arrayElementReference = (IArrayElementReferenceOperation)context.Operation;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
78var operation = context.Operation;
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (4)
61context.Operation.Syntax is not UnaryPatternSyntax) 66var negatedPattern = (INegatedPatternOperation)context.Operation; 81Descriptor, context.Operation.Syntax.GetLocation(), notificationOption, context.Options, additionalLocations: null, properties: null)); 87var operation = context.Operation;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
545var operation = (IMemberReferenceOperation)context.Operation;
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (2)
159var fieldInitializer = (IFieldInitializerOperation)context.Operation; 171var fieldReferenceOperation = (IFieldReferenceOperation)context.Operation;
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
62var arrayCreationOperation = (IArrayCreationOperation)context.Operation; 86var semanticModel = context.Operation.SemanticModel;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (2)
73var declarator = (IVariableDeclaratorOperation)context.Operation; 81var localReference = (ILocalReferenceOperation)context.Operation;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (13)
Semantics\RecordStructTests.cs (4)
6422Assert.Equal(SyntaxKind.RecordDeclaration, context.Operation.Syntax.Kind()); 6423VerifyOperationTree((CSharpCompilation)context.Compilation, context.Operation, @""); 6439switch (context.Operation.Syntax.ToString()) 6457switch (context.Operation.Syntax.ToString())
Semantics\TopLevelStatementsTests.cs (9)
6721Assert.Same(context.ContainingSymbol.DeclaringSyntaxReferences.Single().SyntaxTree, context.Operation.Syntax.SyntaxTree); 6723Assert.Equal(SyntaxKind.InvocationExpression, context.Operation.Syntax.Kind()); 6725switch (context.Operation.Syntax.ToString()) 6742Assert.Same(context.ContainingSymbol.DeclaringSyntaxReferences.Single().GetSyntax(), context.Operation.Syntax); 6743Assert.Equal(SyntaxKind.CompilationUnit, context.Operation.Syntax.Kind()); 6745switch (context.Operation.Syntax.ToString()) 7420Assert.Same(context.ContainingSymbol.DeclaringSyntaxReferences.Single().GetSyntax(), context.Operation.Syntax); 7421Assert.Equal(SyntaxKind.CompilationUnit, context.Operation.Syntax.Kind()); 7423switch (context.Operation.Syntax.ToString())
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
CodeFixes\CodeFixServiceTests.cs (2)
1190=> variableDeclarations.Add(context.Operation.Syntax), OperationKind.VariableDeclaration); 1210context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Operation.Syntax.GetLocation())),
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
Diagnostics\DiagnosticServiceTests.vb (2)
2523context.RegisterOperationAction(Sub(operationContext) AnalyzedOperations.Add(operationContext.Operation), OperationKind.VariableDeclaration) 2527operationBlockStartContext.RegisterOperationAction(Sub(operationContext) AnalyzedOperationsInsideOperationBlock.Add(operationContext.Operation), OperationKind.VariableDeclaration)
Microsoft.CodeAnalysis.Features (31)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (2)
36if (!IsValidTypeofAction(context) || !IsValidOperation(context.Operation)) 41var node = context.Operation.Syntax;
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
97var fieldReference = (IFieldReferenceOperation)operationContext.Operation;
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
52var switchOperation = (TSwitchOperation)context.Operation;
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (3)
64switch (context.Operation) 73throw ExceptionUtilities.UnexpectedValue(context.Operation); 88if (context.Operation.Parent?.Kind == OperationKind.PropertySubpattern)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (4)
34var syntax = context.Operation.Syntax; 38var operation = (IIsPatternOperation)context.Operation; 56var syntax = context.Operation.Syntax; 61var operation = (IBinaryOperation)context.Operation;
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (8)
231var operation = context.Operation; 296var operation = operationContext.Operation; 310var initializer = (IFieldInitializerOperation)operationContext.Operation; 355var memberReference = (IMemberReferenceOperation)operationContext.Operation; 412var operation = operationContext.Operation; 424var targetMethod = ((IInvocationOperation)operationContext.Operation).TargetMethod.OriginalDefinition; 443var nameofArgument = ((INameOfOperation)operationContext.Operation).Argument; 461var constructor = ((IObjectCreationOperation)operationContext.Operation).Constructor?.OriginalDefinition;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (4)
169var expressionStatement = (IExpressionStatementOperation)context.Operation; 229_hasDelegateEscape = !IsHandledDelegateCreationOrAnonymousFunctionTreeShape(operationAnalysisContext.Operation); 235if (operationAnalysisContext.Operation is IParameterReferenceOperation parameterReference) 242_hasDelegateEscape = !IsHandledLocalOrParameterReferenceTreeShape(operationAnalysisContext.Operation);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
105var methodBinding = (IMethodReferenceOperation)context.Operation;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationDiagnosticAnalyzer.cs (1)
51var interpolation = (IInterpolationOperation)context.Operation;
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (2)
124if (context.Operation.Syntax.GetDiagnostics().Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Error)) 129if (context.Operation is not IInvocationOperation invocation)
src\Analyzers\Core\Analyzers\UseConditionalExpression\AbstractUseConditionalExpressionDiagnosticAnalyzer.cs (1)
43var ifOperation = (IConditionalOperation)context.Operation;
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
47var fieldReferenceOperation = (IFieldReferenceOperation)context.Operation;
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (2)
74var throwOperation = (IThrowOperation)context.Operation; 80var semanticModel = context.Operation.SemanticModel;
Microsoft.CodeAnalysis.Test.Utilities (89)
Diagnostics\BoxingOperationAnalyzer.cs (1)
43IOperation operation = operationContext.Operation;
Diagnostics\CommonDiagnosticAnalyzers.cs (17)
1314var rootOperation = operationContext.Operation.GetRootOperation(); 1353ReportDiagnostic(operationContext.ReportDiagnostic, operationContext.Operation.Syntax.GetLocation()); 1365ReportDiagnostic(operationContext.ReportDiagnostic, operationContext.Operation.Syntax.GetLocation()); 1440AnalyzerFieldReferenceOperation((IFieldReferenceOperation)operationAnalysisContext.Operation, operationAnalysisContext.ReportDiagnostic); 1466var diagnostic = Diagnostic.Create(Descriptor, operationContext.Operation.Syntax.GetLocation(), operationContext.ContainingSymbol.Name); 2074operationContext.ReportDiagnostic(Diagnostic.Create(OperationRule, Location.None, symbolStartContext.Symbol.Name, operationContext.ContainingSymbol.Name, operationContext.Operation.Syntax.ToString(), _analyzerId)); 2149diagnostics.Add(Diagnostic.Create(OperationOrderingRule, Location.None, symbolStartContext.Symbol, operationContext.Operation.Syntax.ToString(), _analyzerId)); 2758ReportDiagnostics($"RegisterOperationAction({operationContext.Operation.Syntax}) in RegisterSymbolStartAction", operationContext.Operation.Syntax.SyntaxTree, operationContext.ContainingSymbol, operationContext.ReportDiagnostic), 2772ReportDiagnostics($"RegisterOperationAction({operationContext.Operation.Syntax})", operationContext.Operation.Syntax.SyntaxTree, operationContext.ContainingSymbol, operationContext.ReportDiagnostic), 2785ReportDiagnostics($"RegisterOperationAction({operationContext.Operation.Syntax}) in RegisterOperationBlockStartAction", operationContext.Operation.Syntax.SyntaxTree, operationContext.ContainingSymbol, operationContext.ReportDiagnostic), 2888context => context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Operation.Syntax.GetLocation())), 2943context.RegisterOperationAction(context => HandleCallback(context.Operation.Syntax.GetLocation(), context.Compilation, context.ReportDiagnostic, context.CancellationToken), OperationKind.VariableDeclaration); 3017context.RegisterOperationAction(operationContext => AnalyzedOperations.Add(operationContext.Operation), OperationKind.VariableDeclaration); 3045operationBlockStartContext.RegisterOperationAction(operationContext => AnalyzedOperationsInsideOperationBlock.Add(operationContext.Operation), OperationKind.VariableDeclaration);
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (6)
60if (operationContext.Operation is IAssignmentOperation assignment) 64else if (operationContext.Operation is IIncrementOrDecrementOperation increment) 76throw TestExceptionUtilities.UnexpectedValue(operationContext.Operation); 87IInvocationOperation invocation = (IInvocationOperation)operationContext.Operation; 102IVariableInitializerOperation initializer = (IVariableInitializerOperation)operationContext.Operation; 139IFieldInitializerOperation initializer = (IFieldInitializerOperation)operationContext.Operation;
Diagnostics\EmptyArrayAnalyzer.cs (1)
66IArrayCreationOperation arrayCreation = (IArrayCreationOperation)operationContext.Operation;
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (4)
54if (operationContext.Operation is IAssignmentOperation assignment) 58else if (operationContext.Operation is IIncrementOrDecrementOperation increment) 64throw TestExceptionUtilities.UnexpectedValue(operationContext.Operation); 75IInvocationOperation invocation = (IInvocationOperation)operationContext.Operation;
Diagnostics\LocalCouldBeConstAnalyzer.cs (5)
48if (operationContext.Operation is IAssignmentOperation assignment) 52else if (operationContext.Operation is IIncrementOrDecrementOperation increment) 58throw TestExceptionUtilities.UnexpectedValue(operationContext.Operation); 68IInvocationOperation invocation = (IInvocationOperation)operationContext.Operation; 82IVariableDeclarationGroupOperation declaration = (IVariableDeclarationGroupOperation)operationContext.Operation;
Diagnostics\OperationTestAnalyzer.cs (55)
56var invalidOperation = (IInvalidOperation)operationContext.Operation; 59operationContext.ReportDiagnostic(Diagnostic.Create(InvalidStatementDescriptor, operationContext.Operation.Syntax.GetLocation())); 63operationContext.ReportDiagnostic(Diagnostic.Create(InvalidExpressionDescriptor, operationContext.Operation.Syntax.GetLocation())); 71if (operationContext.Operation.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) 73operationContext.ReportDiagnostic(Diagnostic.Create(IsInvalidDescriptor, operationContext.Operation.Syntax.GetLocation())); 109operationContext.ReportDiagnostic(Diagnostic.Create(ExpressionDescriptor, operationContext.Operation.Syntax.GetLocation())); 146ILoopOperation loop = (ILoopOperation)operationContext.Operation; 338ISwitchOperation switchOperation = (ISwitchOperation)operationContext.Operation; 543IInvocationOperation invocation = (IInvocationOperation)operationContext.Operation; 630ILiteralOperation literal = (ILiteralOperation)operationContext.Operation; 667var argument = (IArgumentOperation)operationContext.Operation; 715var initializer = operationContext.Operation; 752var assignment = (ISimpleAssignmentOperation)operationContext.Operation; 794var initializer = (IArrayInitializerOperation)operationContext.Operation; 842var declarationStatement = (IVariableDeclarationGroupOperation)operationContext.Operation; 899switch (operationContext.Operation.Kind) 902var caseClause = (ICaseClauseOperation)operationContext.Operation; 909var switchSection = (ISwitchCaseOperation)operationContext.Operation; 953IInstanceReferenceOperation instanceReference = (IInstanceReferenceOperation)operationContext.Operation; 1034operationContext.ReportDiagnostic(Diagnostic.Create(EventReferenceDescriptor, operationContext.Operation.Syntax.GetLocation())); 1041IEventAssignmentOperation eventAssignment = (IEventAssignmentOperation)operationContext.Operation; 1042operationContext.ReportDiagnostic(Diagnostic.Create(eventAssignment.Adds ? HandlerAddedDescriptor : HandlerRemovedDescriptor, operationContext.Operation.Syntax.GetLocation())); 1054operationContext.ReportDiagnostic(Diagnostic.Create(PropertyReferenceDescriptor, operationContext.Operation.Syntax.GetLocation())); 1061operationContext.ReportDiagnostic(Diagnostic.Create(FieldReferenceDescriptor, operationContext.Operation.Syntax.GetLocation())); 1068operationContext.ReportDiagnostic(Diagnostic.Create(MethodBindingDescriptor, operationContext.Operation.Syntax.GetLocation())); 1100IInvocationOperation invocation = (IInvocationOperation)operationContext.Operation; 1122IObjectCreationOperation creation = (IObjectCreationOperation)operationContext.Operation; 1181IFieldInitializerOperation equalsValue = (IFieldInitializerOperation)operationContext.Operation; 1192IParameterInitializerOperation equalsValue = (IParameterInitializerOperation)operationContext.Operation; 1226operationContext.ReportDiagnostic(Diagnostic.Create(NoneOperationDescriptor, operationContext.Operation.Syntax.GetLocation())); 1261var addressOfOperation = (IAddressOfOperation)operationContext.Operation; 1313var lambdaExpression = (IAnonymousFunctionOperation)operationContext.Operation; 1314operationContext.ReportDiagnostic(Diagnostic.Create(LambdaExpressionDescriptor, operationContext.Operation.Syntax.GetLocation())); 1323operationContext.ReportDiagnostic(Diagnostic.Create(TooManyStatementsInLambdaExpressionDescriptor, operationContext.Operation.Syntax.GetLocation())); 1336operationContext.ReportDiagnostic(Diagnostic.Create(NoneOperationInLambdaExpressionDescriptor, operationContext.Operation.Syntax.GetLocation())); 1378var operation = operationContext.Operation; 1449ILabelSymbol label = ((ILabeledOperation)operationContext.Operation).Label; 1452operationContext.ReportDiagnostic(Diagnostic.Create(LabelDescriptor, operationContext.Operation.Syntax.GetLocation())); 1460IBranchOperation branch = (IBranchOperation)operationContext.Operation; 1515IBinaryOperation binary = (IBinaryOperation)operationContext.Operation; 1531IUnaryOperation unary = (IUnaryOperation)operationContext.Operation; 1569var binary = (IBinaryOperation)operationContext.Operation; 1608var binary = (IBinaryOperation)operationContext.Operation; 1640var unary = (IUnaryOperation)operationContext.Operation; 1696collector.Visit(operationContext.Operation); 1785var operation = operationContext.Operation; 1845IConditionalAccessOperation conditionalAccess = (IConditionalAccessOperation)operationContext.Operation; 1856IConditionalAccessInstanceOperation conditionalAccessInstance = (IConditionalAccessInstanceOperation)operationContext.Operation; 1894var conversion = (IConversionOperation)operationContext.Operation; 1926ILoopOperation loop = (ILoopOperation)operationContext.Operation; 1971var unary = (IUnaryOperation)operationContext.Operation; 2015operationContext.ReportDiagnostic(Diagnostic.Create(AssignmentOperationDescriptor, operationContext.Operation.Syntax.GetLocation())); 2051var literal = (ILiteralOperation)operationContext.Operation; 2080Diagnostic.Create(OperationActionDescriptor, operationContext.Operation.Syntax.GetLocation(), "Operation", "Analysis")); 2111Diagnostic.Create(OperationActionDescriptor, operationContext.Operation.Syntax.GetLocation(), "Operation", "CompilationStart within Analysis"));
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\AnalysisContextInfoTests.cs (1)
76c.RegisterOperationAction(b => ThrowIfMatch(nameof(c.RegisterOperationAction), new AnalysisContextInfo(b.Compilation, b.Operation)), OperationKind.Return);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\Analyzers\VisualBasic\Analyzers\ConvertTypeofToNameof\VisualBasicConvertTypeOfToNameOfDiagnosticAnalyzer.vb (1)
22Dim node = context.Operation.Syntax
Microsoft.CodeAnalysis.VisualBasic.Features (1)
src\Analyzers\VisualBasic\Analyzers\ConvertTypeofToNameof\VisualBasicConvertTypeOfToNameOfDiagnosticAnalyzer.vb (1)
22Dim node = context.Operation.Syntax
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Diagnostics\GetDiagnosticsTests.vb (1)
641AnalyzeNode(context.Operation.Syntax, context.ContainingSymbol, AddressOf context.ReportDiagnostic)
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (1)
199=> context.Operation.Syntax.FindNode(context.FilterSpan, findInTrivia, getInnermostNodeForTie);
Microsoft.Interop.ComInterfaceGenerator (3)
Analyzers\ComHostingDoesNotSupportGeneratedComInterfaceAnalyzer.cs (1)
43IAttributeOperation attr = (IAttributeOperation)context.Operation;
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (2)
106var operation = (IInvocationOperation)context.Operation; 141var operation = (IConversionOperation)context.Operation;
Microsoft.Interop.LibraryImportGenerator (2)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (1)
644IAttributeOperation attr = (IAttributeOperation)context.Operation;
Analyzers\NativeMarshallingAttributeAnalyzer.cs (1)
86IAttributeOperation attr = (IAttributeOperation)context.Operation;
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
183AnalyzeOperation(context.Operation, methodSymbol, context, onLoadData);
System.Text.RegularExpressions.Generator (2)
UpgradeToGeneratedRegexAnalyzer.cs (2)
93IInvocationOperation invocationOperation = (IInvocationOperation)context.Operation; 125IObjectCreationOperation operation = (IObjectCreationOperation)context.Operation;