0
클래스의 비공개 회원에 대한 모든 참조를 찾고 싶습니다. 나는이 일을 시도했다 :Roslyn의 비공개 회원에 대한 참조 찾기
MemberInfo member = ...//the private member for which I want to find its references
Type type = member.DeclaringType;
string assemblyName = type.Assembly.GetName().Name;
Solution solution = workspace.CurrentSolution;
Project project = solution.Projects.First(x => x.AssemblyName == assemblyName);
Compilation compilation = project.GetCompilation();
ClassDeclarationSyntax classDeclaration = compilation.GetClassDeclaration(type);
MemberDeclarationSyntax memberDeclaration = classDeclaration.GetMemberDeclaration(member.Name);
SemanticModel semanticModel = compilation.GetSemanticModel(classDeclaration.SyntaxTree);
ISymbol memberSymbol = semanticModel.GetSymbolInfo(memberDeclaration).Symbol; ==> this is null since GetSymbolInfo does not expect a MemberDeclaationSyntax
IEnumerable<ReferencedSymbol> references = SymbolFinder.FindReferencesAsync(memberSymbol, solution).Result;
어떻게 개인 회원의 모든 참조를 찾을 수 있습니까?