Skip to content

Make MetadataReferences a top level SG input #55130

@chsienki

Description

@chsienki

Background and Motivation

We have customers today (Razor) who use metadata references as an input to their pipeline. Today it is possible to get these from the compilation object, then use a custom comparer to decide if they have changed, but this is inefficient and requires code per-key press in the IDE, even though the compiler knows they havn't changed.

Proposed API

namespace Microsoft.CodeAnalysis
{
    public readonly struct IncrementalGeneratorInitializationContext
    {
+     public IncrementalValuesProvider<MetadataReference> MetadataReferencesProvider => ...
    }
}

Usage Examples

 var generator = new PipelineCallbackGenerator(ctx => {
                   ctx.RegisterSourceOutput(ctx.MetadataReferencesProvider, (spc, r) => ...);
                 });

Metadata

Metadata

Assignees

Labels

Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.Feature Requestapi-approvedAPI was approved in API review, it can be implemented

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions