From 746e551b8e7ba1e78b20c30acd003f6846980081 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sun, 29 Mar 2015 00:14:15 -0500 Subject: [PATCH] Treat all compiler errors as unexpected --- .../Helpers/DiagnosticVerifier.Helper.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/DiagnosticVerifier.Helper.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/DiagnosticVerifier.Helper.cs index 88fbde558..c776264b7 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/DiagnosticVerifier.Helper.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/DiagnosticVerifier.Helper.cs @@ -71,8 +71,10 @@ protected static async Task> GetSortedDiagnosticsFrom { var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create(analyzer), null, cancellationToken); + var compilerDiagnostics = compilation.GetDiagnostics(cancellationToken); + var compilerErrors = compilerDiagnostics.Where(i => i.Severity == DiagnosticSeverity.Error); var diags = await compilationWithAnalyzers.GetAnalyzerDiagnosticsAsync().ConfigureAwait(false); - foreach (var diag in diags) + foreach (var diag in diags.Concat(compilerErrors)) { if (diag.Location == Location.None || diag.Location.IsInMetadata) {