Create an analyzer as a best effort to detect Compilation and SyntaxNode usage from a PreCompilation node in an Incremental Generator
- 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
Assessment
This issue has not been assessed yet.