376 references to Node
ILLink.RoslynAnalyzer (2)
RequiresAnalyzerBase.cs (2)
77 GenericNameSyntax genericNameSyntaxNode = (GenericNameSyntax) syntaxNodeAnalysisContext.Node; 109 syntaxNodeAnalysisContext.Node.GetLocation (),
Microsoft.Analyzers.Extra (1)
AsyncMethodWithoutCancellation.cs (1)
110Diagnostic.Create(DiagDescriptors.AsyncMethodWithoutCancellation, analysisContext.Node.GetLocation());
Microsoft.Analyzers.Local (1)
InternalReferencedInPublicDocAnalyzer.cs (1)
116var crefNode = (XmlCrefAttributeSyntax)context.Node;
Microsoft.AspNetCore.App.Analyzers (3)
Kestrel\ListenOnIPv6AnyAnalyzer.cs (2)
30if (context.Node is not InvocationExpressionSyntax 41var nodeOperation = context.SemanticModel.GetOperation(context.Node, context.CancellationToken);
WebApplicationBuilder\PublicPartialProgramClassAnalyzer.cs (1)
24var syntaxNode = context.Node;
Microsoft.CodeAnalysis (2)
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (2)
1694/// Syntax tree for the <see cref="Node"/> being analyzed. 1706/// Indicates if the <see cref="Node"/> is generated code.
Microsoft.CodeAnalysis.CodeStyle (23)
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (1)
94=> ShouldSkipAnalysis(context.Node.SyntaxTree, context.Options, context.Compilation.Options, notification, context.CancellationToken);
src\Analyzers\Core\Analyzers\AddRequiredParentheses\AbstractAddRequiredParenthesesDiagnosticAnalyzer.cs (1)
89var binaryLike = (TBinaryLikeExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
55if (context.Node is not TForEachStatementSyntax node)
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
70var namespaceDecl = (TNamespaceSyntax)context.Node;
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
87var symbol = syntaxContext.SemanticModel.GetDeclaredSymbol(syntaxContext.Node, syntaxContext.CancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
47(TCastExpression)context.Node,
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
50var parenthesizedExpression = (TParenthesizedExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\SimplifyBooleanExpression\AbstractSimplifyConditionalDiagnosticAnalyzer.cs (1)
75var conditionalExpression = (TConditionalExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
343var propertyDeclaration = (TPropertyDeclaration)context.Node;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
52var ifStatement = (TIfStatementSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
54var conditionalExpression = (TConditionalExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
50var conditionalExpression = (TConditionalExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (1)
131var objectCreationExpression = (TObjectCreationExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseCompoundAssignment\AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (1)
76var assignment = (TAssignmentSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
68var invocation = context.Node;
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (1)
116var conditionalExpression = (TConditionalExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
38var ifStatement = (TIfStatementSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
96var objectCreationExpression = (TObjectCreationExpressionSyntax)context.Node; 140var syntaxTree = context.Node.SyntaxTree;
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (3)
92var expression = syntaxFacts.GetExpressionOfInvocationExpression(context.Node); 104var arguments = syntaxFacts.GetArgumentsOfInvocationExpression(context.Node); 353context.Node.SyntaxTree,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (1)
205=> context.Node.FindNode(context.FilterSpan, findInTrivia, getInnermostNodeForTie);
Microsoft.CodeAnalysis.CSharp.CodeStyle (60)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
49var statement = context.Node;
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
34var namespaceDeclaration = (FileScopedNamespaceDeclarationSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
34var namespaceDeclaration = (NamespaceDeclarationSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToProgramMainDiagnosticAnalyzer.cs (1)
44var root = (CompilationUnitSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
65var root = (CompilationUnitSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
50var switchStatement = context.Node;
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
66var syntaxTree = context.Node.SyntaxTree; 81var argumentNode = (ArgumentSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
48var ifStatement = (IfStatementSyntax)syntaxContext.Node; 175var tree = syntaxContext.Node.SyntaxTree;
src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (1)
45var anonymousFunction = (AnonymousFunctionExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticDiagnosticAnalyzer.cs (1)
38var localFunction = (LocalFunctionStatementSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
49var thisExpression = (ThisExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\MisplacedUsingDirectives\MisplacedUsingDirectivesDiagnosticAnalyzer.cs (2)
66var namespaceDeclaration = (BaseNamespaceDeclarationSyntax)context.Node; 73var compilationUnit = (CompilationUnitSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementDiagnosticAnalyzer.cs (1)
41var conditionalExpression = (ConditionalExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (1)
32var node = context.Node;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
53var discard = (DiscardDesignationSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
69var anonymousFunction = (AnonymousFunctionExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (1)
18var attributeList = (AttributeListSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (1)
186var invocationExpression = (InvocationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternDiagnosticAnalyzer.cs (1)
59var subpattern = (SubpatternSyntax)syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (2)
39var arrayCreationExpression = (ArrayCreationExpressionSyntax)context.Node; 142var initializer = (InitializerExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
40var invocationExpression = (InvocationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
37var invocationExpression = (InvocationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyDiagnosticAnalyzer.cs (1)
37var memberAccess = (MemberAccessExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
79var memberAccess = (MemberAccessExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (2)
32=> AnalyzeBaseObjectCreationExpression(context, (BaseObjectCreationExpressionSyntax)context.Node, expressionType); 35=> AnalyzeBaseObjectCreationExpression(context, (BaseObjectCreationExpressionSyntax)context.Node, expressionType);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
45var expression = (ImplicitStackAllocArrayCreationExpressionSyntax)context.Node; 87var expression = (StackAllocArrayCreationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
59var coalesceExpression = (BinaryExpressionSyntax)context.Node; 125var ifStatement = (IfStatementSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
48switch (context.Node)
src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
41var syntaxTree = context.Node.SyntaxTree; 43var defaultExpression = (DefaultExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (3)
53var nodeKind = context.Node.Kind(); 58var grandparent = context.Node.GetRequiredParent().GetRequiredParent(); 79var diagnostic = AnalyzeSyntax(options, context.Node, context, helper, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
62var declaration = (LambdaExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (2)
41var syntaxTree = context.Node.SyntaxTree; 54var objectCreation = (ObjectCreationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
34var declarationStatement = context.Node;
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (5)
26switch (context.Node.Kind()) 29ReportDiagnosticsIfNeeded((NameColonSyntax)context.Node, context); 32ReportDiagnosticsIfNeeded((NameEqualsSyntax)context.Node, context); 44var syntaxTree = context.Node.SyntaxTree; 89additionalUnnecessaryLocations: [context.Node.SyntaxTree.GetLocation(fadeSpan)]));
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
52var binaryExpression = (BinaryExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
84var anonymousFunction = (AnonymousFunctionExpressionSyntax)syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
58var attribute = (AttributeSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
50var expression = (ExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (1)
64var asExpression = (BinaryExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
56var node = syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
74var isExpression = (BinaryExpressionSyntax)syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (1)
62var node = context.Node;
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
84var outermostUsing = (UsingStatementSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (1)
70var localDeclarationStatement = (LocalDeclarationStatementSyntax)syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
64var invocation = (InvocationExpressionSyntax)syntaxContext.Node;
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (3)
CommandLineTests.cs (3)
15946context.ReportDiagnostic(Diagnostic.Create(Hidden01, context.Node.GetLocation())); 15970if ((context.Node as PragmaWarningDirectiveTriviaSyntax).DisableOrRestoreKeyword.IsKind(SyntaxKind.RestoreKeyword)) 15972context.ReportDiagnostic(Diagnostic.Create(Info01, context.Node.GetLocation()));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (3)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (2)
325Assert.NotEqual(SyntaxKind.MethodDeclaration, context.Node.Kind()); 326context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Node.GetLocation()));
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
49if (context.Node is SimpleNameSyntax node)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (47)
Diagnostics\DiagnosticAnalyzerTests.cs (16)
55var id = (IdentifierNameSyntax)context.Node; 251switch (context.Node.Kind()) 254var diag1 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.Node.GetLocation(), "Attribute"); 259var diag2 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.Node.GetLocation(), "ClassDeclaration"); 264var diag3 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.Node.GetLocation(), "UsingDirective"); 667var fieldDeclaration = (FieldDeclarationSyntax)context.Node; 808switch (CSharpExtensions.Kind(context.Node.Parent)) 1655nodeContext.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(ExpressionDescriptor, nodeContext.Node.GetLocation())); 2323sortedCallbackEntityNames.Add($"Node: {syntaxContext.Node.ToString()}"); 2324ReportNodeDiagnostics(syntaxContext.Node, syntaxContext.ReportDiagnostic); 3850context => context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Rule, context.Node.GetLocation())), 3856context => context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Rule, context.Node.GetLocation())), 4086var recordDeclaration = (RecordDeclarationSyntax)context.Node; 4132if (!_topmostNode.FullSpan.Contains(context.Node.FullSpan)) 4135var diagnostic = CodeAnalysis.Diagnostic.Create(Rule, context.Node.GetLocation(), context.Node.Kind(), context.ContainingSymbol.Name);
Diagnostics\GetDiagnosticsTests.cs (3)
966context => analyzeNode(context.Node, context.ContainingSymbol, context.ReportDiagnostic), 1006if (!uniqueCallbacks.Add(context.Node)) 1007throw new Exception($"Multiple callbacks for {context.Node}");
Semantics\OutVarTests.cs (2)
18812var tree = context.Node.SyntaxTree; 18814var constructorDeclaration = (ConstructorDeclarationSyntax)context.Node.Parent;
Semantics\PrimaryConstructorTests.cs (17)
3768var literal = (LiteralExpressionSyntax)context.Node; 3807var equalsValue = (EqualsValueClauseSyntax)context.Node; 3833var initializer = (ConstructorInitializerSyntax)context.Node; 3857var baseType = (PrimaryConstructorBaseTypeSyntax)context.Node; 3882var @class = (ClassDeclarationSyntax)context.Node; 3909var identifier = (IdentifierNameSyntax)context.Node; 3947var baseType = (SimpleBaseTypeSyntax)context.Node; 3991var parameterList = (ParameterListSyntax)context.Node; 4017var argumentList = (ArgumentListSyntax)context.Node; 5270var literal = (LiteralExpressionSyntax)context.Node; 5296var equalsValue = (EqualsValueClauseSyntax)context.Node; 5314var initializer = (ConstructorInitializerSyntax)context.Node; 5343var record = (StructDeclarationSyntax)context.Node; 5361var identifier = (IdentifierNameSyntax)context.Node; 5374var baseType = (SimpleBaseTypeSyntax)context.Node; 5401var parameterList = (ParameterListSyntax)context.Node; 5423var argumentList = (ArgumentListSyntax)context.Node;
Semantics\RecordTests.cs (9)
26253var literal = (LiteralExpressionSyntax)context.Node; 26292var equalsValue = (EqualsValueClauseSyntax)context.Node; 26318var initializer = (ConstructorInitializerSyntax)context.Node; 26342var baseType = (PrimaryConstructorBaseTypeSyntax)context.Node; 26367var record = (RecordDeclarationSyntax)context.Node; 26390var identifier = (IdentifierNameSyntax)context.Node; 26428var baseType = (SimpleBaseTypeSyntax)context.Node; 26472var parameterList = (ParameterListSyntax)context.Node; 26498var argumentList = (ArgumentListSyntax)context.Node;
Microsoft.CodeAnalysis.CSharp.Features (61)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
49var statement = context.Node;
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
34var namespaceDeclaration = (FileScopedNamespaceDeclarationSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
34var namespaceDeclaration = (NamespaceDeclarationSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToProgramMainDiagnosticAnalyzer.cs (1)
44var root = (CompilationUnitSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
65var root = (CompilationUnitSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
50var switchStatement = context.Node;
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
66var syntaxTree = context.Node.SyntaxTree; 81var argumentNode = (ArgumentSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
48var ifStatement = (IfStatementSyntax)syntaxContext.Node; 175var tree = syntaxContext.Node.SyntaxTree;
src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (1)
45var anonymousFunction = (AnonymousFunctionExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticDiagnosticAnalyzer.cs (1)
38var localFunction = (LocalFunctionStatementSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
49var thisExpression = (ThisExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\MisplacedUsingDirectives\MisplacedUsingDirectivesDiagnosticAnalyzer.cs (2)
66var namespaceDeclaration = (BaseNamespaceDeclarationSyntax)context.Node; 73var compilationUnit = (CompilationUnitSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementDiagnosticAnalyzer.cs (1)
41var conditionalExpression = (ConditionalExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (1)
32var node = context.Node;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
53var discard = (DiscardDesignationSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
69var anonymousFunction = (AnonymousFunctionExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (1)
18var attributeList = (AttributeListSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (1)
186var invocationExpression = (InvocationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternDiagnosticAnalyzer.cs (1)
59var subpattern = (SubpatternSyntax)syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (2)
39var arrayCreationExpression = (ArrayCreationExpressionSyntax)context.Node; 142var initializer = (InitializerExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
40var invocationExpression = (InvocationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
37var invocationExpression = (InvocationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyDiagnosticAnalyzer.cs (1)
37var memberAccess = (MemberAccessExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
79var memberAccess = (MemberAccessExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (2)
32=> AnalyzeBaseObjectCreationExpression(context, (BaseObjectCreationExpressionSyntax)context.Node, expressionType); 35=> AnalyzeBaseObjectCreationExpression(context, (BaseObjectCreationExpressionSyntax)context.Node, expressionType);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
45var expression = (ImplicitStackAllocArrayCreationExpressionSyntax)context.Node; 87var expression = (StackAllocArrayCreationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
59var coalesceExpression = (BinaryExpressionSyntax)context.Node; 125var ifStatement = (IfStatementSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
48switch (context.Node)
src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
41var syntaxTree = context.Node.SyntaxTree; 43var defaultExpression = (DefaultExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (3)
53var nodeKind = context.Node.Kind(); 58var grandparent = context.Node.GetRequiredParent().GetRequiredParent(); 79var diagnostic = AnalyzeSyntax(options, context.Node, context, helper, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
62var declaration = (LambdaExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (2)
41var syntaxTree = context.Node.SyntaxTree; 54var objectCreation = (ObjectCreationExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
34var declarationStatement = context.Node;
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (5)
26switch (context.Node.Kind()) 29ReportDiagnosticsIfNeeded((NameColonSyntax)context.Node, context); 32ReportDiagnosticsIfNeeded((NameEqualsSyntax)context.Node, context); 44var syntaxTree = context.Node.SyntaxTree; 89additionalUnnecessaryLocations: [context.Node.SyntaxTree.GetLocation(fadeSpan)]));
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
52var binaryExpression = (BinaryExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
84var anonymousFunction = (AnonymousFunctionExpressionSyntax)syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
58var attribute = (AttributeSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
50var expression = (ExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (1)
64var asExpression = (BinaryExpressionSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
56var node = syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
74var isExpression = (BinaryExpressionSyntax)syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (1)
62var node = context.Node;
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
84var outermostUsing = (UsingStatementSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (1)
70var localDeclarationStatement = (LocalDeclarationStatementSyntax)syntaxContext.Node;
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
64var invocation = (InvocationExpressionSyntax)syntaxContext.Node;
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (1)
81var isExpression = (BinaryExpressionSyntax)context.Node;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (21)
Diagnostics\Configuration\ConfigureSeverity\AllAnalyzersSeverityConfigurationTests.cs (1)
38c => c.ReportDiagnostic(Diagnostic.Create(Rule, c.Node.GetLocation())),
Diagnostics\Configuration\ConfigureSeverity\CategoryBasedSeverityConfigurationTests.cs (1)
38c => c.ReportDiagnostic(Diagnostic.Create(Rule, c.Node.GetLocation())),
Diagnostics\Configuration\ConfigureSeverity\DotNetDiagnosticSeverityBasedSeverityConfigurationTests.cs (1)
38c => c.ReportDiagnostic(Diagnostic.Create(Rule, c.Node.GetLocation())),
Diagnostics\Suppression\RemoveSuppressionTests.cs (1)
48var classDecl = (ClassDeclarationSyntax)context.Node;
Diagnostics\Suppression\SuppressionTest_FixMultipleTests.cs (1)
50var classDecl = (ClassDeclarationSyntax)context.Node;
Diagnostics\Suppression\SuppressionTests.cs (16)
708var classDecl = (ClassDeclarationSyntax)context.Node; 818var classDecl = (ClassDeclarationSyntax)context.Node; 881var classDecl = (ClassDeclarationSyntax)context.Node; 931var classDecl = (ClassDeclarationSyntax)context.Node; 1072switch (context.Node.Kind()) 1075var classDecl = (ClassDeclarationSyntax)context.Node; 1080var ns = (NamespaceDeclarationSyntax)context.Node; 1085var method = (MethodDeclarationSyntax)context.Node; 1090var property = (PropertyDeclarationSyntax)context.Node; 1095var field = (FieldDeclarationSyntax)context.Node; 1100var e = (EventDeclarationSyntax)context.Node; 1106foreach (var trivia in context.Node.DescendantTrivia().Where(t => t.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia)) 2066switch (context.Node.Kind()) 2069var classDecl = (ClassDeclarationSyntax)context.Node; 2074var ns = (NamespaceDeclarationSyntax)context.Node; 2079var method = (MethodDeclarationSyntax)context.Node;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (14)
Semantics\ColorColorTests.cs (1)
1785var memberAccessExpression = context.Node as MemberAccessExpressionSyntax;
Semantics\RecordStructTests.cs (8)
5969var literal = (LiteralExpressionSyntax)context.Node; 5995var equalsValue = (EqualsValueClauseSyntax)context.Node; 6013var initializer = (ConstructorInitializerSyntax)context.Node; 6042var record = (RecordDeclarationSyntax)context.Node; 6060var identifier = (IdentifierNameSyntax)context.Node; 6073var baseType = (SimpleBaseTypeSyntax)context.Node; 6100var parameterList = (ParameterListSyntax)context.Node; 6122var argumentList = (ArgumentListSyntax)context.Node;
Semantics\TopLevelStatementsTests.cs (5)
6438var globalStatement = (GlobalStatementSyntax)context.Node; 6468var unit = (CompilationUnitSyntax)context.Node; 7066var node = (CSharpSyntaxNode)context.Node; 7100var node = (CSharpSyntaxNode)context.Node; 7181var node = (CSharpSyntaxNode)context.Node;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (8)
Symbols\Source\NullablePublicAPITests.cs (8)
1167if (syntaxContext.Node.ToString() != "o") return; 1168var info = syntaxContext.SemanticModel.GetTypeInfoAndVerifyIOperation(syntaxContext.Node); 1169Assert.True(syntaxContext.SemanticModel.TryGetSpeculativeSemanticModel(syntaxContext.Node.SpanStart, newSource, out var specModel)); 1171syntaxContext.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_descriptor1, syntaxContext.Node.GetLocation(), syntaxContext.Node, info.Nullability.FlowState, info.Nullability.Annotation, specInfo.Nullability.FlowState)); 1176var declarator = (VariableDeclaratorSyntax)context.Node; 1791var node = (MemberAccessExpressionSyntax)context.Node; 4847var node = (MemberAccessExpressionSyntax)context.Node;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (3)
Diagnostics\DiagnosticServiceTests.vb (3)
1380Dim fieldDecl = DirectCast(context.Node, CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax) 2530context.RegisterSyntaxNodeAction(Sub(syntaxNodeContext) AnalyzedSyntaxNodes.Add(syntaxNodeContext.Node), SyntaxKind.LocalDeclarationStatement) 2534codeBlockStartContext.RegisterSyntaxNodeAction(Sub(syntaxNodeContext) AnalyzedSyntaxNodesInsideCodeBlock.Add(syntaxNodeContext.Node), SyntaxKind.LocalDeclarationStatement)
Microsoft.CodeAnalysis.Features (26)
Diagnostics\Analyzers\UnboundIdentifiersDiagnosticAnalyzerBase.cs (2)
61if (context.Node is TIncompleteMemberSyntax) 63ReportUnboundIdentifierNames(context, context.Node);
PreferFrameworkType\PreferFrameworkTypeDiagnosticAnalyzerBase.cs (1)
70var typeNode = (TTypeSyntax)context.Node;
SimplifyThisOrMe\AbstractSimplifyThisOrMeDiagnosticAnalyzer.cs (1)
54var node = context.Node;
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (1)
94=> ShouldSkipAnalysis(context.Node.SyntaxTree, context.Options, context.Compilation.Options, notification, context.CancellationToken);
src\Analyzers\Core\Analyzers\AddRequiredParentheses\AbstractAddRequiredParenthesesDiagnosticAnalyzer.cs (1)
89var binaryLike = (TBinaryLikeExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
55if (context.Node is not TForEachStatementSyntax node)
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
70var namespaceDecl = (TNamespaceSyntax)context.Node;
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
87var symbol = syntaxContext.SemanticModel.GetDeclaredSymbol(syntaxContext.Node, syntaxContext.CancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
47(TCastExpression)context.Node,
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
50var parenthesizedExpression = (TParenthesizedExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\SimplifyBooleanExpression\AbstractSimplifyConditionalDiagnosticAnalyzer.cs (1)
75var conditionalExpression = (TConditionalExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
343var propertyDeclaration = (TPropertyDeclaration)context.Node;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
52var ifStatement = (TIfStatementSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
54var conditionalExpression = (TConditionalExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
50var conditionalExpression = (TConditionalExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (1)
131var objectCreationExpression = (TObjectCreationExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseCompoundAssignment\AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (1)
76var assignment = (TAssignmentSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
68var invocation = context.Node;
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (1)
116var conditionalExpression = (TConditionalExpressionSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
38var ifStatement = (TIfStatementSyntax)context.Node;
src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
96var objectCreationExpression = (TObjectCreationExpressionSyntax)context.Node; 140var syntaxTree = context.Node.SyntaxTree;
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (3)
92var expression = syntaxFacts.GetExpressionOfInvocationExpression(context.Node); 104var arguments = syntaxFacts.GetArgumentsOfInvocationExpression(context.Node); 353context.Node.SyntaxTree,
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Diagnostics\PullDiagnosticTests.cs (1)
151context.ReportDiagnostic(Diagnostic.Create(_descriptor, context.Node.GetLocation())),
Microsoft.CodeAnalysis.Test.Utilities (21)
Diagnostics\CommonDiagnosticAnalyzers.cs (13)
658syntaxNodeContext.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptor, syntaxNodeContext.Node.GetLocation())); 688context.ReportDiagnostic(Diagnostic.Create(Rule, context.Node.GetLocation())); 728context.ReportDiagnostic(Diagnostic.Create(Rule, context.Node.GetLocation())); 2762ReportDiagnostics($"RegisterSyntaxNodeAction({syntaxNodeContext.Node}) in RegisterSymbolStartAction", syntaxNodeContext.Node.SyntaxTree, syntaxNodeContext.ContainingSymbol, syntaxNodeContext.ReportDiagnostic), 2795ReportDiagnostics($"RegisterSyntaxNodeAction({syntaxNodeContext.Node})", syntaxNodeContext.Node.SyntaxTree, syntaxNodeContext.ContainingSymbol, syntaxNodeContext.ReportDiagnostic), 2808ReportDiagnostics($"RegisterSyntaxNodeAction({syntaxNodeContext.Node}) in RegisterCodeBlockStartAction", syntaxNodeContext.Node.SyntaxTree, syntaxNodeContext.ContainingSymbol, syntaxNodeContext.ReportDiagnostic), 2882context => context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Node.GetLocation())), 2937context.RegisterSyntaxNodeAction(context => HandleCallback(context.Node.GetLocation(), context.Compilation, context.ReportDiagnostic, context.CancellationToken), CodeAnalysis.CSharp.SyntaxKind.ClassDeclaration); 3018context.RegisterSyntaxNodeAction(syntaxNodeContext => AnalyzedSyntaxNodes.Add(syntaxNodeContext.Node), SyntaxKind.LocalDeclarationStatement); 3052codeBlockStartContext.RegisterSyntaxNodeAction(syntaxNodeContext => AnalyzedSyntaxNodesInsideCodeBlock.Add(syntaxNodeContext.Node), SyntaxKind.LocalDeclarationStatement);
Diagnostics\OperationTestAnalyzer.cs (3)
2023syntaxContext.ReportDiagnostic(Diagnostic.Create(AssignmentSyntaxDescriptor, syntaxContext.Node.GetLocation())); 2139var node = syntaxContext.Node; 2151var node = syntaxContext.Node;
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (4)
160context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.Node.GetLocation(), messageArgs: context.Node.ToFullString())); 179context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.Node.GetLocation(), messageArgs: context.Node.ToFullString()));
Diagnostics\TestDiagnosticAnalyzer.cs (1)
100OnAbstractMember("SyntaxNode", context.Node);
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\AnalysisContextInfoTests.cs (1)
80c.RegisterSyntaxNodeAction(b => ThrowIfMatch(nameof(c.RegisterSyntaxNodeAction), new AnalysisContextInfo(b.SemanticModel.Compilation, b.Node)), SyntaxKind.ReturnStatement);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (10)
src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValDiagnosticAnalyzer.vb (1)
30Dim parameterSyntax = DirectCast(syntaxContext.Node, ParameterSyntax)
src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessarySuppressions\VisualBasicRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.vb (1)
18Dim attribute = DirectCast(syntaxContext.Node, AttributeSyntax)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedMembers\VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (1)
47For Each node In context.Node.DescendantNodes()
src\Analyzers\VisualBasic\Analyzers\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationDiagnosticAnalyzer.vb (1)
42Dim node = context.Node
src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (5)
28Select Case context.Node.Kind() 30ReportDiagnosticsIfNeeded(DirectCast(context.Node, NameColonEqualsSyntax), context) 33ReportDiagnosticsIfNeeded(DirectCast(context.Node, NamedFieldInitializerSyntax), context) 44Dim syntaxTree = context.Node.SyntaxTree 78Dim syntaxTree = context.Node.SyntaxTree
src\Analyzers\VisualBasic\Analyzers\UseIsNotExpression\VisualBasicUseIsNotDiagnosticAnalyzer.vb (1)
43Dim node = syntaxContext.Node
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (3)
CommandLineTests.vb (3)
10991context.ReportDiagnostic(Diagnostic.Create(Hidden01, context.Node.GetLocation())) 11016context.ReportDiagnostic(Diagnostic.Create(Info01, context.Node.GetLocation())) 11090context.ReportDiagnostic(Diagnostic.Create(Error01, context.Node.GetLocation()))
Microsoft.CodeAnalysis.VisualBasic.Features (10)
src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValDiagnosticAnalyzer.vb (1)
30Dim parameterSyntax = DirectCast(syntaxContext.Node, ParameterSyntax)
src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessarySuppressions\VisualBasicRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.vb (1)
18Dim attribute = DirectCast(syntaxContext.Node, AttributeSyntax)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedMembers\VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (1)
47For Each node In context.Node.DescendantNodes()
src\Analyzers\VisualBasic\Analyzers\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationDiagnosticAnalyzer.vb (1)
42Dim node = context.Node
src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (5)
28Select Case context.Node.Kind() 30ReportDiagnosticsIfNeeded(DirectCast(context.Node, NameColonEqualsSyntax), context) 33ReportDiagnosticsIfNeeded(DirectCast(context.Node, NamedFieldInitializerSyntax), context) 44Dim syntaxTree = context.Node.SyntaxTree 78Dim syntaxTree = context.Node.SyntaxTree
src\Analyzers\VisualBasic\Analyzers\UseIsNotExpression\VisualBasicUseIsNotDiagnosticAnalyzer.vb (1)
43Dim node = syntaxContext.Node
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (19)
Diagnostics\Configuration\ConfigureSeverity\DotNetDiagnosticSeverityBasedSeverityConfigurationTests.vb (1)
35Sub(c) c.ReportDiagnostic(Diagnostic.Create(Rule, c.Node.GetLocation())),
Diagnostics\Suppression\SuppressionTests.vb (18)
710Dim classDecl = DirectCast(context.Node, ClassStatementSyntax) 785Dim classDecl = DirectCast(context.Node, ClassStatementSyntax) 829Dim classDecl = DirectCast(context.Node, ClassStatementSyntax) 895Dim classDecl = DirectCast(context.Node, ClassStatementSyntax) 1015Select Case context.Node.Kind() 1017Dim classDecl = DirectCast(context.Node, ClassStatementSyntax) 1022Dim ns = DirectCast(context.Node, NamespaceStatementSyntax) 1027Dim method = DirectCast(context.Node, MethodStatementSyntax) 1032Dim p = DirectCast(context.Node, PropertyStatementSyntax) 1037Dim f = DirectCast(context.Node, FieldDeclarationSyntax) 1042Dim e = DirectCast(context.Node, EventStatementSyntax) 1731Select Case context.Node.Kind() 1733Dim classDecl = DirectCast(context.Node, ClassStatementSyntax) 1738Dim ns = DirectCast(context.Node, NamespaceStatementSyntax) 1743Dim method = DirectCast(context.Node, MethodStatementSyntax) 1748Dim p = DirectCast(context.Node, PropertyStatementSyntax) 1753Dim f = DirectCast(context.Node, FieldDeclarationSyntax) 1758Dim e = DirectCast(context.Node, EventStatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (11)
Diagnostics\DiagnosticAnalyzerTests.vb (8)
40Dim id = CType(context.Node, IdentifierNameSyntax) 278Dim moduleStatement = DirectCast(context.Node, ModuleStatementSyntax) 279context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(desc1, context.Node.GetLocation)) 362Select Case context.Node.Kind 364location = DirectCast(context.Node, NamespaceBlockSyntax).NamespaceStatement.Name.GetLocation 366location = DirectCast(context.Node, ClassBlockSyntax).BlockStatement.Identifier.GetLocation 575Dim sourceLoc = DirectCast(context.Node, FieldDeclarationSyntax).GetLocation 962nodeContext.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(ExpressionDescriptor, nodeContext.Node.GetLocation()))
Diagnostics\GetDiagnosticsTests.vb (3)
620If Not uniqueCallbacks.Add(nodeContext.Node) Then 621Throw New Exception($"Multiple callbacks for {nodeContext.Node}") 628AnalyzeNode(context.Node, context.ContainingSymbol, AddressOf context.ReportDiagnostic)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (1)
Parser\ParseDirectives.vb (1)
3174context.ReportDiagnostic(_reporter(context.Node, _descriptor))
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (1)
205=> context.Node.FindNode(context.FilterSpan, findInTrivia, getInnermostNodeForTie);
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
BatchFixAllProviderTests.cs (1)
71var node = (LiteralExpressionSyntax)context.Node;
Microsoft.DotNet.CodeAnalysis (2)
Analyzers\AppContextDefaultsAnalyzer.cs (1)
62InvocationExpressionSyntax call = context.Node as InvocationExpressionSyntax;
Analyzers\ResourceUsageAnalyzer.cs (1)
36InvocationExpressionSyntax invokeExpr = context.Node as InvocationExpressionSyntax;
Microsoft.ML.InternalCodeAnalyzer (15)
ContractsCheckAnalyzer.cs (1)
184var invocation = (InvocationExpressionSyntax)context.Node;
NameAnalyzer.cs (9)
92=> CheckPascal(((ClassDeclarationSyntax)context.Node).Identifier, context); 95=> CheckPascal(((EnumDeclarationSyntax)context.Node).Identifier, context); 98=> CheckPascal(((EnumMemberDeclarationSyntax)context.Node).Identifier, context); 101=> CheckPascal(((EventDeclarationSyntax)context.Node).Identifier, context); 105var node = (MethodDeclarationSyntax)context.Node; 113var node = ((NamespaceDeclarationSyntax)context.Node); 122=> CheckPascal(((PropertyDeclarationSyntax)context.Node).Identifier, context); 126CheckPascal(((StructDeclarationSyntax)context.Node).Identifier, context); 145var node = (BaseFieldDeclarationSyntax)context.Node;
ParameterVariableNameAnalyzer.cs (2)
43var node = (ParameterSyntax)context.Node; 49var node = (LocalDeclarationStatementSyntax)context.Node;
SingleVariableDeclarationAnalyzer.cs (2)
42var node = (VariableDeclarationSyntax)context.Node; 47var diagnostic = Diagnostic.Create(Rule, context.Node.GetLocation(), jointVariableNames);
TypeParamNameAnalyzer.cs (1)
41var node = (TypeParameterSyntax)context.Node;
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.cs (1)
32var invocationExpr = (InvocationExpressionSyntax)context.Node;
System.Windows.Forms.Analyzers.VisualBasic (1)
Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.vb (1)
33Dim invocationExpr = DirectCast(context.Node, InvocationExpressionSyntax)