SourceGeneratorContext Struct

Definition

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

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

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.

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

ReportDiagnostic(Diagnostic)

Adds a Diagnostic to the users compilation

Applies to