I'm using Roslyn to rewrite some methods used throughout a solution.
I was able to find and fix many instances. However, it's not finding all references. Many more show up in Visual Studio with CodeLens or using "Find All References." The solution compiles with no errors.
The references it's not finding seem to be only overloaded methods called from web applications in the solution. But it finds references to non-overloaded methods in these web applications.
I'm finding the symbols for the necessary methods and looping through them, searching for references like this:
MSBuildWorkspace workspace = MSBuildWorkspace.Create();
Solution solution = await workspace.OpenSolutionAsync(@"..\Solutions\Main.sln");
var symbols = await FindSymbols(solution);
foreach (var symbol in symbols)
{
var callers = await SymbolFinder.FindCallersAsync(symbol, solution);
// Modify code
}
workspace.TryApplyChanges(solution);
I've also tried SymbolFinder.FindReferencesAsync()
and it also does not find the remaining references.
I can't figure out what to do to allow Roslyn to find these additional references that are found in Visual Studio.