dotnet / dotnet/roslyn

Create an analyzer as a best effort to detect Compilation and SyntaxNode usage from a PreCompilation node in an Incremental Generator

Open
#83,333 1 comment 0 reactions 1 assignee Claimed by @chsienki View on GitHub
Area-Compilers
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Tracking issue for a best-effort analyzer that detects use of `Compilation` or `SyntaxNode` flowing into a node registered via `RegisterPreCompilationSourceOutput`.

A fully accurate analyzer is not possible in general -- the actual inputs to a generator pipeline are only known by executing the registration code, since nodes can be added imperatively or conditionally (e.g. by helper methods, as Razor does). However, @333fred requested that we ship at least a simple/best-effort analyzer to catch the common cases where the misuse is statically obvious.

See discussion: https://github.com/dotnet/roslyn/pull/83088#discussion_r3079256827
Feature doc: docs/features/pre-compilation-source-outputs.md

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.