Microsoft.CodeAnalysis Namespace

Classes

AdditionalDocument

Represents an additional file passed down to analyzers.

AdditionalText

Represents a non source code file.

AdhocWorkspace

A workspace that allows full manipulation of projects and documents, but does not persist changes.

AnalyzerConfig

Represents a single EditorConfig file, see https://editorconfig.org for details about the format.

AnalyzerConfig.Section

Represents a named section of the editorconfig file, which consists of a name followed by a set of key-value pairs.

AnalyzerConfigDocument
AnalyzerConfigSet

Represents a set of AnalyzerConfig, and can compute the effective analyzer options for a given source file. This is used to collect all the AnalyzerConfig files for that would apply to a compilation.

AnnotationExtensions
AssemblyIdentity

Represents an identity of an assembly as defined by CLI metadata specification.

AssemblyIdentityComparer

Compares assembly identities. Derived types may implement platform specific unification and portability policies.

AssemblyMetadata

Represents an immutable snapshot of assembly CLI metadata.

AttributeData
CaseInsensitiveComparison

Case-insensitive operations (mostly comparison) on unicode strings.

CodeAnalysisProgress

Represents the progress of an operation. Commonly used to update a UI visible to a user when a long running operation is happening.

CommandLineArguments

The base class for representing command line arguments to a Microsoft.CodeAnalysis.CommonCompiler.

CommandLineParser
CommandLineProject
Compilation

The compilation object is an immutable representation of a single invocation of the compiler. Although immutable, a compilation is also on-demand, and will realize and cache data as necessary. A compilation can produce a new compilation from existing compilation with the application of small deltas. In many cases, it is more efficient than creating a new compilation from scratch, as the new compilation can reuse information from the old compilation.

CompilationOptions

Represents compilation options common to C# and VB.

CompilationReference

Reference to another C# or VB compilation.

ControlFlowAnalysis

Provides information about statements which transfer control in and out of a region. This information is returned from a call to Microsoft.CodeAnalysis.SemanticModel.AnalyzeControlFlow(Microsoft.CodeAnalysis.SyntaxNode).

CSharpExtensions
CustomModifier
DataFlowAnalysis

Provides information about how data flows into and out of a region. This information is returned from a call to Microsoft.CodeAnalysis.SemanticModel.AnalyzeDataFlow(Microsoft.CodeAnalysis.SyntaxNode,Microsoft.CodeAnalysis.SyntaxNode), or one of its language-specific overloads, where you pass the first and last statements of the region as parameters. "Inside" means those statements or ones between them. "Outside" are any other statements of the same method.

DesktopAssemblyIdentityComparer
DesktopStrongNameProvider

Provides strong name and signs source assemblies.

Diagnostic

Represents a diagnostic, such as a compiler error or a warning, along with the location where it occurred.

DiagnosticDescriptor

Provides a description about a Diagnostic

DiagnosticFormatter

Formats Diagnostic messages.

DllImportData

Information that describes how a method from the underlying Platform is to be invoked.

Document

Represents a source code document that is part of a project. It provides access to the source text, parsed syntax tree and the corresponding semantic model.

DocumentActiveContextChangedEventArgs
DocumentationCommentId

APIs for constructing documentation comment id's, and finding symbols that match ids.

DocumentationProvider

A class used to provide XML documentation to the compiler for members from metadata. A custom implementation of this class should be returned from a DocumentationResolver to provide XML documentation comments from custom caches or locations.

DocumentDiagnostic
DocumentEventArgs
DocumentId

An identifier that can be used to retrieve the same Document across versions of the workspace.

DocumentInfo

A class that represents all the arguments necessary to create a new document instance.

EmbeddedText

Represents text to be embedded in a PDB.

ErrorLogOptions

Options controlling the generation of a SARIF log file containing compilation or analyzer diagnostics.

ExtensionOrderAttribute
FileSystemExtensions
FileTextLoader
GeneratorAttribute

Place this attribute onto a type to cause it to be considered a source generator

GeneratorDriver

Responsible for orchestrating a source generation pass

GeneratorDriverRunResult

Represents the results of running a generation pass over a set of ISourceGenerators.

GeneratorExtensions
IncrementalGeneratorRunStep

A description of a step of an incremental generator that was executed.

IncrementalValueProviderExtensions
ISymbolExtensions
LanguageNames

A class that provides constants for common language names.

LocalizableResourceString

A localizable resource string that may possibly be formatted differently depending on culture.

LocalizableString

A string that may possibly be formatted differently depending on culture. NOTE: Types implementing LocalizableString must be serializable.

Location

A program location in source code.

Metadata

Represents immutable assembly or module CLI metadata.

MetadataId

An Id that can be used to identify a metadata instance. If two metadata instances have the same id then they are guaranteed to have the same content. If two metadata instances have different ids, then the contents may or may not be the same. As such, the id is useful as a key in a cache when a client wants to share data for a metadata reference as long as it has not changed.

MetadataReference

Represents metadata image reference.

MetadataReferenceResolver

Resolves references to metadata specified in the source (#r directives).

ModelExtensions
ModuleMetadata

Represents an immutable snapshot of module CLI metadata.

NullableContextExtensions
NullableContextOptionsExtensions
ParseOptions

Represents parse options common to C# and VB.

PortableExecutableReference

Reference to metadata stored in the standard ECMA-335 metadata format.

Project

Represents a project that is part of a Solution.

ProjectDependencyGraph

A ProjectDependencyGraph models the dependencies between projects in a solution.

ProjectDiagnostic
ProjectId

An identifier that can be used to refer to the same Project across versions.

ProjectInfo

A class that represents all the arguments necessary to create a new project instance.

ProjectReference
ResourceDescription

Representation of a resource whose contents are to be embedded in the output assembly.

RuleSet

Represents a set of rules as specified in a ruleset file.

RuleSetInclude

Represents a Include tag in a RuleSet file.

SarifVersionFacts
ScriptCompilationInfo
SemanticModel

Allows asking semantic questions about a tree of syntax nodes in a Compilation. Typically, an instance is obtained by a call to GetSemanticModel(SyntaxTree, SemanticModelOptions).

SeparatedSyntaxList
Solution

Represents a set of projects and their source code documents.

SolutionId

An identifier that can be used to refer to the same Solution across versions.

SolutionInfo

A class that represents all the arguments necessary to create a new solution instance.

SourceFileResolver

Resolves references to source files specified in source code.

SourceGeneratedDocument

A Document that was generated by an ISourceGenerator.

SourceReferenceResolver

Resolves references to source documents specified in the source.

StrongNameProvider

Provides strong name and signs source assemblies.

SuppressionDescriptor

Provides a description about a programmatic suppression of a Diagnostic by a DiagnosticSuppressor.

SymbolDisplayExtensions

Exposes extension methods for displaying symbol descriptions.

SymbolDisplayFormat

Describes the formatting rules that should be used when displaying symbols.

SymbolEqualityComparer

Allows for the comparison of two ISymbol instances

SymbolVisitor
SymbolVisitor<TResult>
SymbolVisitor<TArgument,TResult>
SyntaxAnnotation

A SyntaxAnnotation is used to annotate syntax elements with additional information.

Since syntax elements are immutable, annotating them requires creating new instances of them with the annotations attached.

SyntaxList
SyntaxNode

Represents a non-terminal node in the syntax tree. This is the language agnostic equivalent of CSharpSyntaxNode and VisualBasicSyntaxNode.

SyntaxNodeExtensions
SyntaxReference

A reference to a syntax node.

SyntaxTree

The parsed representation of a source document.

SyntaxTreeOptionsProvider
SyntaxWalker

Walks the syntax tree, allowing subclasses to operate on all nodes, token and trivia. The walker will perform a depth first walk of the tree.

TextAndVersion

A class that represents both a source text and its version stamp.

TextDocument
TextDocumentEventArgs
TextLoader

A class that represents access to a source text and its version from a storage location.

UnresolvedMetadataReference

Represents a metadata reference that can't be or is not yet resolved.

VisualBasicExtensions

Addition Visual Basic syntax extension methods.

WellKnownDiagnosticTags
WellKnownGeneratorInputs

Well known incremental generator input step names.

WellKnownGeneratorOutputs

Well known incremental generator output step names.

WellKnownMemberNames

Specifies the member names known to the compiler (such as .ctor or op_Explicit).

Workspace

A workspace provides access to a active set of source code projects and documents and their associated syntax trees, compilations and semantic models. A workspace has a current solution that is an immutable snapshot of the projects and documents. This property may change over time as the workspace is updated either from live interactions in the environment or via call to the workspace's TryApplyChanges(Solution) method.

WorkspaceChangeEventArgs

The EventArgs describing any kind of workspace change.

WorkspaceDiagnostic
WorkspaceDiagnosticEventArgs
WorkspaceKind

Known workspace kinds

WorkspaceRegistration
XmlDocumentationProvider

A class used to provide XML documentation to the compiler for members from metadata from an XML document source.

XmlFileResolver

Resolves references to XML files specified in the source.

XmlReferenceResolver

Resolves references to XML documents specified in source code.

Structs

AnalyzerConfig.SectionNameMatcher
AnalyzerConfigOptionsResult

Holds results from GetOptionsForSourcePath(String).

ChildSyntaxList
ChildSyntaxList.Enumerator

Enumerates the elements of a ChildSyntaxList.

ChildSyntaxList.Reversed
ChildSyntaxList.Reversed.Enumerator
CommandLineAnalyzerReference

Describes a command line analyzer assembly specification.

CommandLineReference

Describes a command line metadata reference (assembly or netmodule) specification.

CommandLineSourceFile

Describes a source file specification stored on command line arguments.

CompilationOutputInfo

Paths of files produced by the compilation.

FileLinePositionSpan

Represents a span of text in a source code file in terms of file name, line number, and offset within line. However, the file is actually whatever was passed in when asked to parse; there may not really be a file.

GeneratedSourceResult

Represents the results of an ISourceGenerator calling AddSource(String, SourceText).

GeneratedSourceText

A source text created by an ISourceGenerator

GeneratorAttributeSyntaxContext
GeneratorDriverOptions

Options passed to a GeneratorDriver during creation

GeneratorDriverTimingInfo

Contains timing information for a full generation pass.

GeneratorExecutionContext

Context passed to a source generator when Execute(GeneratorExecutionContext) is called

GeneratorFilterContext

Context passed to a filter to determine if a generator should be executed or not.

GeneratorInitializationContext

Context passed to a source generator when Initialize(GeneratorInitializationContext) is called

GeneratorPostInitializationContext

Context passed to a source generator when it has opted-in to PostInitialization via RegisterForPostInitialization(Action<GeneratorPostInitializationContext>)

GeneratorRunResult

Represents the results of a single ISourceGenerator generation pass.

GeneratorSyntaxContext

Context passed to an ISyntaxContextReceiver when OnVisitSyntaxNode(GeneratorSyntaxContext) is called

GeneratorTimingInfo

Contains timing information for a single generator.

HostOutputProductionContext

Context passed to an incremental generator when it has registered an output via RegisterHostOutput<TSource>(IncrementalValuesProvider<TSource>, Action<HostOutputProductionContext,TSource>)

ImportedNamespaceOrType

Represents an INamespaceOrTypeSymbol that has been imported, and the location the import was declared at. This corresponds to using Namespace; or using static Type; in C#, or Imports TypeOrNamespace in Visual Basic.

ImportedXmlNamespace

Represents an imported xml namespace name. This corresponds to Imports <xmlns:prefix = "name"> in Visual Basic. It does not exist for C#.

IncrementalGeneratorInitializationContext

Context passed to an incremental generator when Initialize(IncrementalGeneratorInitializationContext) is called

IncrementalGeneratorPostInitializationContext

Context passed to an incremental generator when it has registered an output via RegisterPostInitializationOutput(Action<IncrementalGeneratorPostInitializationContext>)

IncrementalValueProvider<TValue>

Represents a provider of a single value that can be transformed as part of constructing an execution pipeline

IncrementalValuesProvider<TValues>

Represents a provider of multiple values that can be transformed to construct an execution pipeline

InitializationContext

Context passed to a source generator when Initialize(InitializationContext) is called

IOperation.OperationList

Implements a struct-based collection of Microsoft.CodeAnalysis.Operation nodes. This collection is ordered, but random access into the collection is not provided.

IOperation.OperationList.Enumerator

Implements a struct-based enumerator for Microsoft.CodeAnalysis.Operation nodes. This type is not hardened to default(Enumerator), and will null reference in these cases. Calling Current after MoveNext() has returned false will throw an InvalidOperationException.

IOperation.OperationList.Reversed

Implements a reverse-order struct-based collection of Microsoft.CodeAnalysis.Operation nodes. This collection is ordered, but random access into the collection is not provided.

IOperation.OperationList.Reversed.Enumerator

Implements a reverse-order struct-based enumerator for Microsoft.CodeAnalysis.Operation nodes. This type is not hardened to default(Enumerator), and will null reference in these cases. Calling Current after MoveNext() has returned false will throw an InvalidOperationException.

LineMapping

Represents a line mapping defined by a single line mapping directive (#line in C# or #ExternalSource in VB).

LoadTextOptions

Options used to load SourceText.

MetadataReferenceProperties

Information about a metadata reference.

NullabilityInfo
Optional<T>

Combines a value, Value, and a flag, HasValue, indicating whether or not that value is meaningful.

PreprocessingSymbolInfo
ProjectChanges
SeparatedSyntaxList<TNode>.Enumerator
SeparatedSyntaxList<TNode>
SolutionChanges
SourceGeneratorContext

Context passed to a source generator when Execute(SourceGeneratorContext) is called

SourceProductionContext

Context passed to an incremental generator when it has registered an output via RegisterSourceOutput<TSource>(IncrementalValueProvider<TSource>, Action<SourceProductionContext,TSource>)

SubsystemVersion

Represents subsystem version, see /subsystemversion command line option for details and valid values.

The following table lists common subsystem versions of Windows.

Windows version Subsystem version

  • Windows 2000 5.00
  • Windows XP 5.01
  • Windows Vista 6.00
  • Windows 7 6.01
  • Windows 8 Release Preview 6.02
SymbolDisplayPart

A single element of a symbol description. For example, a keyword, a punctuation character or a class name.

SymbolInfo
SyntaxList<TNode>.Enumerator
SyntaxList<TNode>

A list of SyntaxNode.

SyntaxNodeOrToken

A wrapper for either a syntax node (SyntaxNode) or a syntax token (SyntaxToken).

SyntaxNodeOrTokenList

A list of SyntaxNodeOrToken structures.

SyntaxNodeOrTokenList.Enumerator

Enumerator for lists of SyntaxNodeOrToken structs.

SyntaxToken

Represents a token in the syntax tree.

SyntaxTokenList

Represents a read-only list of SyntaxToken.

SyntaxTokenList.Enumerator

A structure for enumerating a SyntaxTokenList

SyntaxTokenList.Reversed

Reversed enumerable.

SyntaxTokenList.Reversed.Enumerator
SyntaxTrivia

Represents a trivia in the syntax tree.

SyntaxTriviaList

Represents a read-only list of SyntaxTrivia.

SyntaxTriviaList.Enumerator
SyntaxTriviaList.Reversed

Reversed enumerable.

SyntaxTriviaList.Reversed.Enumerator
SyntaxValueProvider

Allows a user to create Syntax based input nodes for incremental generation

TypedConstant

Represents a constant value used as an argument to a custom attribute.

TypeInfo
VersionStamp

VersionStamp should be only used to compare versions returned by same API.

Interfaces

IAliasSymbol

Represents a using alias (Imports alias in Visual Basic).

IAnalyzerAssemblyLoader

Handles loading analyzer assemblies and their dependencies.

Before an analyzer assembly is loaded with LoadFromPath(String), its location and the location of all of its dependencies must first be specified by calls to AddDependencyLocation(String).

IArrayTypeSymbol

Represents an array.

IAssemblySymbol

Represents a .NET assembly, consisting of one or more modules.

ICompilationUnitSyntax

Interface implemented by any node that is the root 'CompilationUnit' of a SyntaxTree. i.e. any node returned by GetRoot(CancellationToken) where HasCompilationUnitRoot is true will implement this interface.

This interface provides a common way to both easily find the root of a SyntaxTree given any SyntaxNode, as well as a common way for handling the special EndOfFileToken that is needed to store all final trivia in a SourceText that is not owned by any other SyntaxToken.

IDiscardSymbol

A symbol representing a discarded value, e.g. a symbol in the result of GetSymbolInfo for _ in M(out _) or (x, _) = e.

IDynamicTypeSymbol

Represents the 'dynamic' type in C#.

IErrorTypeSymbol

An IErrorTypeSymbol is used when the compiler cannot determine a symbol object to return because of an error. For example, if a field is declared "Goo x;", and the type "Goo" cannot be found, an IErrorTypeSymbol is returned when asking the field "x" what it's type is.

IEventSymbol

Represents an event.

IFieldSymbol

Represents a field in a class, struct or enum.

IFunctionPointerTypeSymbol

Represents a function pointer type such as "delegate*<void>".

IImportScope

Represents the set of symbols that are imported to a particular position in a source file. Each import has a reference to the location the import directive was declared at. For the IAliasSymbol import, the location can be found using either Locations or DeclaringSyntaxReferences on the IAliasSymbol itself. For Imports or XmlNamespaces the location is found through DeclaringSyntaxReference or DeclaringSyntaxReference respectively.

IIncrementalGenerator

The base interface required to implement an incremental generator

ILabelSymbol

Represents a label in method body

ILocalSymbol

Represents a local variable in method body.

IMethodSymbol

Represents a method or method-like symbol (including constructor, destructor, operator, or property/event accessor).

IModuleSymbol

Represents a module within an assembly. Every assembly contains one or more modules.

INamedTypeSymbol

Represents a type other than an array, a pointer, a type parameter.

INamespaceOrTypeSymbol

Represents either a namespace or a type.

INamespaceSymbol

Represents a namespace.

IOperation

Root type for representing the abstract semantics of C# and VB statements and expressions.

IParameterSymbol

Represents a parameter of a method or property.

IPointerTypeSymbol

Represents a pointer type such as "int *". Pointer types are used only in unsafe code.

IPreprocessingSymbol

Represents a preprocessing conditional compilation symbol.

IPropertySymbol

Represents a property or indexer.

IRangeVariableSymbol

Represents a range variable in a query expression.

ISkippedTokensTriviaSyntax

Represents structured trivia that contains skipped tokens. This is implemented by SkippedTokensTriviaSyntax and SkippedTokensTriviaSyntax.

ISourceAssemblySymbol

Represents a source assembly symbol exposed by the compiler.

ISourceGenerator

The base interface required to implement a source generator

IStructuredTriviaSyntax

Represents the root node of a structured trivia tree (for example, a preprocessor directive or a documentation comment). From this root node you can traverse back up to the containing trivia in the outer tree that contains it.

ISupportedChangesService

Can be acquired from Services, with GetService<TWorkspaceService>().

ISymbol

Represents a symbol (namespace, class, method, parameter, etc.) exposed by the compiler.

ISyntaxContextReceiver

Receives notifications of each SyntaxNode in the compilation, along with a
SemanticModel that can be queried to obtain more information, before generation runs.

ISyntaxReceiver

Receives notifications of each SyntaxNode in the compilation before generation runs

ITypeParameterSymbol

Represents a type parameter in a generic type or generic method.

ITypeSymbol

Represents a type.

Enums

Accessibility

Enumeration for common accessibility combinations.

ApplyChangesKind
AssemblyIdentityComparer.ComparisonResult

A set of possible outcomes of AssemblyIdentity comparison.

AssemblyIdentityParts
CandidateReason

Indicates the reasons why a candidate (or set of candidate) symbols were not considered correct in SemanticInfo. Higher values take precedence over lower values, so if, for example, there a symbol with a given name that was inaccessible, and other with the wrong arity, only the inaccessible one would be reported in the SemanticInfo.

DiagnosticSeverity

Describes how severe a diagnostic is.

DocumentationMode

Specifies the different documentation comment processing modes.

GeneratedKind
IncrementalGeneratorOutputKind

Represents the various output kinds of an IIncrementalGenerator.

IncrementalStepRunReason

The state of the output of a given executed incremental source generator step.

LineVisibility

The state of the visibility of a line.

LocationKind

Specifies the kind of location (source vs. metadata).

MetadataImageKind

The kind of metadata a PE file image contains.

MetadataImportOptions

Specifies what symbols to import from metadata.

MethodKind

Enumeration for possible kinds of method symbols.

NamespaceKind

Describes the kind of the namespace extent.

NullableAnnotation

Represents the nullability of values that can be assigned to an expression used as an lvalue.

NullableContext

Represents the state of the nullable analysis at a specific point in a file. Bits one and two correspond to whether the nullable feature is enabled. Bits three and four correspond to whether the context was inherited from the global context.

NullableContextOptions

Represents the default state of nullable analysis in this compilation.

NullableFlowState

Represents the compiler's analysis of whether an expression may be null

OperationKind

All of the kinds of operations, including statements and expressions.

OptimizationLevel

Determines the level of optimization of the generated code.

OutputKind

Specifies output assembly kinds generated by compiler.

Platform
PreservationMode

The mode in which value is preserved.

RefKind

Denotes the kind of reference.

ReportDiagnostic

Describes how to report a warning diagnostic.

RuntimeCapability

Specifies capabilities that may or may not be supported by the common language runtime the compilation is targeting.

SarifVersion

Specifies the version of the SARIF log file to produce.

ScopedKind

Enumeration for kinds of scoped modifiers.

SemanticModelOptions
SourceCodeKind

Specifies the C# or VB source code kind.

SpecialType

Specifies the Ids of special runtime types.

SpeculativeBindingOption

Describes the kind of binding to be performed in one of the SemanticModel speculative binding methods.

SymbolDisplayDelegateStyle

Specifies how to display delegates (just the name or the name with the signature).

SymbolDisplayExtensionMethodStyle

Specifies how to display extension methods.

SymbolDisplayGenericsOptions

Specifies the options for how generics are displayed in the description of a symbol.

SymbolDisplayGlobalNamespaceStyle

Specifies the options for how to display the global namespace in the description of a symbol.

SymbolDisplayKindOptions

Specifies which kind keywords should be included when displaying symbols.

SymbolDisplayLocalOptions

Specifies the options for how locals are displayed in the description of a symbol.

SymbolDisplayMemberOptions

Specifies the options for how members are displayed in the description of a symbol.

SymbolDisplayMiscellaneousOptions

Specifies miscellaneous options about the format of symbol descriptions.

SymbolDisplayParameterOptions

Specifies how parameters are displayed in the description of a (member, property/indexer, or delegate) symbol.

SymbolDisplayPartKind

Specifies the kinds of a piece of classified text (SymbolDisplayPart).

SymbolDisplayPropertyStyle

Specifies the options for how properties are displayed in symbol descriptions.

SymbolDisplayTypeQualificationStyle

Specifies how much qualification is used in symbol descriptions.

SymbolFilter

Indicate what kinds of declaration symbols will be included

SymbolKind

Specifies the possible kinds of symbols.

SyntaxRemoveOptions
SyntaxWalkerDepth

Syntax the SyntaxWalker should descend into.

TextDocumentKind

Indicates kind of a TextDocument

TypedConstantKind

Represents the kind of a TypedConstant.

TypeKind

Enumeration for possible kinds of type symbols.

TypeParameterKind

Represents the different kinds of type parameters.

VarianceKind

An enumeration declaring the kinds of variance supported for generic type parameters.

WorkspaceChangeKind
WorkspaceDiagnosticKind

Delegates

SyntaxContextReceiverCreator

Allows a generator to provide instances of an ISyntaxContextReceiver

SyntaxReceiverCreator

Allows a generator to provide instances of an ISyntaxReceiver