PreCompilationSourceProductionContext Struct

Definition

Context passed to an incremental generator when it has registered an output via RegisterPreCompilationSourceOutput<TSource>(IncrementalValueProvider<TSource>, Action<PreCompilationSourceProductionContext,TSource>). Pre-compilation source outputs execute before the compilation is available and can only add source files, not report diagnostics.

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

Properties

Name Description
CancellationToken

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

Methods

Name Description
AddSource(String, SourceText)

Adds a SourceText to the compilation

AddSource(String, String)

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

Applies to