Click or drag to resize

AnalysisContext Class



Context for initializing an analyzer. Analyzer initialization can use an AnalysisContext to register actions to be executed at any of:
  • compilation start,
  • compilation end,
  • completion of parsing a code document,
  • completion of semantic analysis of a code document,
  • completion of semantic analysis of a symbol,
  • start of semantic analysis of a method body or an expression appearing outside a method body,
  • completion of semantic analysis of a method body or an expression appearing outside a method body, or
  • completion of semantic analysis of a syntax node.
Inheritance Hierarchy
SystemObject
  Microsoft.CodeAnalysis.DiagnosticsAnalysisContext

Namespace:  Microsoft.CodeAnalysis.Diagnostics
Assembly:  Microsoft.CodeAnalysis (in Microsoft.CodeAnalysis.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public abstract class AnalysisContext

The AnalysisContext type exposes the following members.

Constructors
  NameDescription
Protected methodAnalysisContext
Initializes a new instance of the AnalysisContext class
Top
Methods
  NameDescription
Public methodConfigureGeneratedCodeAnalysis
Configure analysis mode of generated code for this analyzer. Non-configured analyzers will default to an appropriate default mode for generated code. It is recommended for the analyzer to invoke this API with the required GeneratedCodeAnalysisFlags setting.
Public methodEnableConcurrentExecution
Enable concurrent execution of analyzer actions registered by this analyzer. An analyzer that registers for concurrent execution can have better performance than a non-concurrent analyzer. However, such an analyzer must ensure that its actions can execute correctly in parallel.
Public methodRegisterCodeBlockAction
Public methodRegisterCodeBlockStartActionTLanguageKindEnum
Public methodRegisterCompilationAction
Public methodRegisterCompilationStartAction
Public methodRegisterOperationAction(ActionT, Void)
Public methodRegisterOperationBlockAction
Public methodRegisterOperationBlockStartAction
Public methodRegisterSemanticModelAction
Public methodRegisterSymbolAction(ActionT, Void)
Public methodRegisterSyntaxNodeActionTLanguageKindEnum(ActionT, Void)
Public methodRegisterSyntaxTreeAction
Public methodTryGetValueTValue
Attempts to compute or get the cached value provided by the given valueProvider for the given text. Note that the pair {valueProvider, text} acts as the key. Reusing the same valueProvider instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
Top
See Also