Delen via


GeneratorExecutionContext Struct

Definition

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

public readonly struct GeneratorExecutionContext
type GeneratorExecutionContext = struct
Public Structure GeneratorExecutionContext
Inheritance
GeneratorExecutionContext

Properties

AdditionalFiles

A set of additional non-code text files that can be used by generators.

AnalyzerConfigOptions

Allows access to options provided by an analyzer config

CancellationToken

A CancellationToken that can be checked to see if the generation should be cancelled.

Compilation

Get the current Compilation at the time of execution.

ParseOptions

Get the ParseOptions that will be used to parse any added sources.

SyntaxContextReceiver

If the generator registered an ISyntaxContextReceiver during initialization, this will be the instance created for this generation pass.

SyntaxReceiver

If the generator registered an ISyntaxReceiver during initialization, this will be the instance created for this generation pass.

Methods

AddSource(String, SourceText)

Adds a SourceText to the compilation

AddSource(String, String)

Adds source code in the form of a String to the compilation.

ReportDiagnostic(Diagnostic)

Adds a Diagnostic to the users compilation

Applies to