Roslyn not finding all references

左心房为你撑大大i 提交于 2019-12-23 05:32:15

问题


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.

来源:https://stackoverflow.com/questions/42562142/roslyn-not-finding-all-references

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!