/// <summary> /// Return all diagnostics that belong to given project for the given StateSets (analyzers) by calculating them /// </summary> public async Task <ImmutableDictionary <DiagnosticAnalyzer, AnalysisResult> > ComputeDiagnosticsAsync( CompilationWithAnalyzers analyzerDriverOpt, Project project, IEnumerable <StateSet> stateSets, CancellationToken cancellationToken) { try { var result = ImmutableDictionary <DiagnosticAnalyzer, AnalysisResult> .Empty; // analyzerDriver can be null if given project doesn't support compilation. if (analyzerDriverOpt != null) { // calculate regular diagnostic analyzers diagnostics var compilerResult = await analyzerDriverOpt.AnalyzeAsync(project, cancellationToken).ConfigureAwait(false); result = compilerResult.AnalysisResult; // record telemetry data UpdateAnalyzerTelemetryData(compilerResult, project, cancellationToken); } // check whether there is IDE specific project diagnostic analyzer return(await MergeProjectDiagnosticAnalyzerDiagnosticsAsync(project, stateSets, analyzerDriverOpt?.Compilation, result, cancellationToken).ConfigureAwait(false)); } catch (Exception e) when(FatalError.ReportUnlessCanceled(e)) { throw ExceptionUtilities.Unreachable; } }
/// <summary> /// Return all diagnostics that belong to given project for the given StateSets (analyzers) by calculating them /// </summary> public async Task <ImmutableDictionary <DiagnosticAnalyzer, AnalysisResult> > ComputeDiagnosticsAsync( CompilationWithAnalyzers analyzerDriverOpt, Project project, IEnumerable <StateSet> stateSets, CancellationToken cancellationToken) { var result = ImmutableDictionary <DiagnosticAnalyzer, AnalysisResult> .Empty; // analyzerDriver can be null if given project doesn't support compilation. if (analyzerDriverOpt != null) { // calculate regular diagnostic analyzers diagnostics result = await analyzerDriverOpt.AnalyzeAsync(project, cancellationToken).ConfigureAwait(false); // record telemetry data await UpdateAnalyzerTelemetryDataAsync(analyzerDriverOpt, project, cancellationToken).ConfigureAwait(false); } // check whether there is IDE specific project diagnostic analyzer return(await MergeProjectDiagnosticAnalyzerDiagnosticsAsync(project, stateSets, analyzerDriverOpt?.Compilation, result, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Return all diagnostics that belong to given project for the given StateSets (analyzers) by calculating them /// </summary> public async Task<ImmutableDictionary<DiagnosticAnalyzer, AnalysisResult>> ComputeDiagnosticsAsync( CompilationWithAnalyzers analyzerDriverOpt, Project project, IEnumerable<StateSet> stateSets, CancellationToken cancellationToken) { try { var result = ImmutableDictionary<DiagnosticAnalyzer, AnalysisResult>.Empty; // analyzerDriver can be null if given project doesn't support compilation. if (analyzerDriverOpt != null) { // calculate regular diagnostic analyzers diagnostics var compilerResult = await analyzerDriverOpt.AnalyzeAsync(project, cancellationToken).ConfigureAwait(false); result = compilerResult.AnalysisResult; // record telemetry data UpdateAnalyzerTelemetryData(compilerResult, project, cancellationToken); } // check whether there is IDE specific project diagnostic analyzer return await MergeProjectDiagnosticAnalyzerDiagnosticsAsync(project, stateSets, analyzerDriverOpt?.Compilation, result, cancellationToken).ConfigureAwait(false); } catch (Exception e) when (FatalError.ReportUnlessCanceled(e)) { throw ExceptionUtilities.Unreachable; } }
/// <summary> /// Return all diagnostics that belong to given project for the given StateSets (analyzers) by calculating them /// </summary> public async Task<ImmutableDictionary<DiagnosticAnalyzer, AnalysisResult>> ComputeDiagnosticsAsync( CompilationWithAnalyzers analyzerDriverOpt, Project project, IEnumerable<StateSet> stateSets, CancellationToken cancellationToken) { var result = ImmutableDictionary<DiagnosticAnalyzer, AnalysisResult>.Empty; // analyzerDriver can be null if given project doesn't support compilation. if (analyzerDriverOpt != null) { // calculate regular diagnostic analyzers diagnostics result = await analyzerDriverOpt.AnalyzeAsync(project, cancellationToken).ConfigureAwait(false); // record telemetry data await UpdateAnalyzerTelemetryDataAsync(analyzerDriverOpt, project, cancellationToken).ConfigureAwait(false); } // check whether there is IDE specific project diagnostic analyzer return await MergeProjectDiagnosticAnalyzerDiagnosticsAsync(project, stateSets, analyzerDriverOpt?.Compilation, result, cancellationToken).ConfigureAwait(false); }