Beispiel #1
0
        public async Task <IEnumerable <string> > GetAnalyzerFilesAsync(string identifier, CancellationToken cancellationToken = default)
        {
            ISymbol diagnosticDescriptor = DiagnosticDescriptors.FirstOrDefault(f => f.Name == identifier);

            if (diagnosticDescriptor == null)
            {
                throw new InvalidOperationException($"Diagnostic descriptor symbol not found for identifier '{identifier}'.");
            }

            IEnumerable <ReferencedSymbol> referencedSymbols = await SymbolFinder.FindReferencesAsync(diagnosticDescriptor, Solution, cancellationToken).ConfigureAwait(false);

            ISymbol diagnosticIdentifier = DiagnosticIdentifiers.FirstOrDefault(f => f.Name == identifier);

            if (diagnosticIdentifier == null)
            {
                throw new InvalidOperationException($"Diagnostic identifier symbol not found for identifier '{identifier}'.");
            }

            IEnumerable <ReferencedSymbol> referencedSymbols2 = await SymbolFinder.FindReferencesAsync(diagnosticIdentifier, Solution, cancellationToken).ConfigureAwait(false);

            return(GetFilePaths(referencedSymbols.Concat(referencedSymbols2)));
        }