Skip to content

Incremental SG - Unit-testing the pipeline / caching-behaviour using GeneratorDriver #61230

Open

Description

🤞 Hope this is a suitable place for general guidance to Roslyn, if not feel free to close :)

Hi all! I've been wrestling a lot with incremental SGs lately. The main thing I'm uncertain about at the moment is how caching behaves in my pipeline. I've been trying to unit-test this using the GeneratorDriver class, similar to what is described in the SG cookbook.

However, I have two main issues:

  1. Is there a simple way of accessing data about what stages ran etc? There is some data hidden deep within the GeneratorDriver, but it's not very accessible.

  2. I've been simulating changes to source-code using Compilation.ReplaceSyntaxTree. However, when running the GeneratorDriver after such a replace, it seems that all pipeline nodes 'derived' from the original SyntaxTree is re-evaluted (breakpoint is hit), even if the input to the node has been cached. Simply adding a new SyntaxTree using Compilation.AddSyntaxTree does not cause a re-evaluation of the original SyntaxTree. Is there a better way of approaching this, or is this simply the expected behaviour?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions