'Roslyn Find References to Parameter

I am trying to port a custom MsBuild Target to a Roslyn source generator.

The old code used SymbolFinder to find references to a parameter inside a methods body. In the source generator I cannot use the SymbolFinderany more since I do not have access to the Solution.

Basically the problem looks like this

void Method(IFoo foo)
{
    foo.Do();

    foo.Dont();
}

I have the BlockSyntax of the methods body and the ParameterSytnax of the parameter and I need to find the Location of both calls to foo.

I might also have to find references to this in the whole Compilation, since it could be passed around.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source