public ProjectAnalyzerStateSets( Project project, ImmutableDictionary <object, ImmutableArray <DiagnosticAnalyzer> > mapPerReferences, ImmutableDictionary <DiagnosticAnalyzer, StateSet> analyzerMap, DiagnosticAnalyzerInfoCache analyzerInfoCache, HostDiagnosticAnalyzers hostAnalyzers) : this(project.AnalyzerReferences, mapPerReferences, analyzerMap, analyzerInfoCache.GetOrCreateSkippedAnalyzersInfo(project, hostAnalyzers)) { Contract.ThrowIfNull(project); Contract.ThrowIfNull(mapPerReferences); Contract.ThrowIfNull(analyzerMap); }
public async Task <DiagnosticAnalysisResultMap <string, DiagnosticAnalysisResultBuilder> > GetDiagnosticsAsync( IEnumerable <AnalyzerReference> hostAnalyzers, IEnumerable <string> analyzerIds, bool reportSuppressedDiagnostics, bool logAnalyzerExecutionTime, CancellationToken cancellationToken) { var analyzerMap = CreateAnalyzerMap(hostAnalyzers, _project); var analyzers = GetAnalyzers(analyzerMap, analyzerIds); if (analyzers.Length == 0) { return(DiagnosticAnalysisResultMap <string, DiagnosticAnalysisResultBuilder> .Empty); } var cacheService = _project.Solution.Workspace.Services.GetRequiredService <IProjectCacheService>(); using var cache = cacheService.EnableCaching(_project.Id); var skippedAnalyzersInfo = _analyzerInfoCache.GetOrCreateSkippedAnalyzersInfo(_project, hostAnalyzers); return(await AnalyzeAsync(analyzerMap, analyzers, skippedAnalyzersInfo, reportSuppressedDiagnostics, logAnalyzerExecutionTime, cancellationToken).ConfigureAwait(false)); }
private ISkippedAnalyzersInfo GetOrCreateSkippedAnalyzersInfo(Project project) => DiagnosticAnalyzerInfoCache.GetOrCreateSkippedAnalyzersInfo(project, HostAnalyzers);