internal static void CompilationError(DiagnosticBag localDiagnostics, DiagnosticBag diagnostics) { if (diagnostics != null) { return; } var firstError = localDiagnostics.FirstOrDefault(d => d.Info.Severity == DiagnosticSeverity.Error); if (firstError != null) { throw new CompilationErrorException(firstError.ToString(System.Globalization.CultureInfo.CurrentCulture), new ReadOnlyArray <CommonDiagnostic>(localDiagnostics.ToArray())); } }