Incremental source generators in .NET only avoid redundant work when pipeline values compare equal via `EqualityComparer<T>.Default`. The most common silent failure is using `ImmutableArray<T>` in a `record` model — it compares by reference, not contents, causing a permanent cache miss on every keystroke. The fix is a small `EquatableArray<T>` wrapper that implements proper value equality using `SequenceEqual` over spans. Beyond arrays, pipeline models must never hold `ISymbol`, `Compilation`, or `SyntaxNode` references — these compare by reference across compilations and root entire compilation snapshots in memory. The correct pattern is to flatten symbol data into primitive strings and `EquatableArray<string>` exactly once inside the transform, then let the framework handle caching downstream.

11m read timeFrom daily-devops.net
Post cover image
Table of contents
The Mental Model: A Pipeline of Equality-Checked ValuesThe Default You Will Get Wrong FirstThe Fix: EquatableArray<T>Strip to the Smallest Equatable Shape EarlyWhy Symbols Poison the CacheThe Contract
6.7K Impressions