SourceGeneratorContext Struct
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 |