// virtual for testing purposes. internal virtual Action <Exception, DiagnosticAnalyzer, Diagnostic> GetOnAnalyzerException(ProjectId projectId, DiagnosticLogAggregator diagnosticLogAggregator) { return((ex, analyzer, diagnostic) => { // Log telemetry, if analyzer supports telemetry. DiagnosticAnalyzerLogger.LogAnalyzerCrashCount(analyzer, ex, diagnosticLogAggregator, projectId); AnalyzerHelper.OnAnalyzerException_NoTelemetryLogging(ex, analyzer, diagnostic, _hostDiagnosticUpdateSource, projectId); }); }
private bool CatchAnalyzerException(Exception e, DiagnosticAnalyzer analyzer, bool testOnly_DonotCatchAnalyzerExceptions) { DiagnosticAnalyzerLogger.LogAnalyzerCrashCount(analyzer, e, _logAggregator); if (testOnly_DonotCatchAnalyzerExceptions) { return(false); } if (AnalyzerHelper.IsBuiltInAnalyzer(analyzer)) { return(FatalError.ReportWithoutCrashUnlessCanceled(e)); } return(true); }
private bool CatchAnalyzerException(Exception e, DiagnosticAnalyzer analyzer, bool testOnly_DonotCatchAnalyzerExceptions) { DiagnosticAnalyzerLogger.LogAnalyzerCrashCount(analyzer, e, this.logAggregator); if (testOnly_DonotCatchAnalyzerExceptions) { return(false); } // TODO: move it to AnalyzerHelper later. if (!DiagnosticAnalyzerService.ShouldHandleAnalyzer(analyzer) || IsCompilerAnalyzer(analyzer)) { return(FatalError.ReportWithoutCrashUnlessCanceled(e)); } return(true); }