Grouping and joining IncrementalValuesProviders for an incremental source generator

Erik Smit 35 Reputation points
2024-04-11T13:22:12.4+00:00

I am experimenting with Incremental source generators and Interceptors.

This question is related to the use of IncrementalValuesProviders specified in https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md

The goal is to generate argument checks based on attributes applied to the parameters of a function. For this i have 2 IncrementlValuesProviders, one contains the method declarations of all methods i am interested in. The other contains all method invocations. I want to combine these 2 so that i have a single valuesprovider that has the method declaration and an array of all of it's usages.

This is the flow i am trying to achieve

User's image Currently i have the method declarations and the invocations, i want to group the invocations by method and combine that with the method declarations. With this information i will generate code with Interceptors to intercept all usages of a method. How can i achieve the grouping and combining?

Community Center | Not monitored
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.