Skip to content

Commit

Permalink
Don't silently eat a certain class of analyzer-thrown exceptions
Browse files Browse the repository at this point in the history
If an analyzer threw an exception, we generate a message that tells
you what diagnostic IDs the analzyer produces, so you know what to
disable so you can work around the analyzer. If the analyzer then also
were to throw exceptions while we ask it for it's SupportedDiagnostics,
we were eating that exception. This includes that as well.
  • Loading branch information
jasonmalinowski committed Feb 2, 2022
1 parent d23fe1e commit 45fbb55
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1657,9 +1657,9 @@ private static string CreateDisablingMessage(DiagnosticAnalyzer analyzer)
diagnosticIds = diagnosticIds.Add(diagnostic.Id);
}
}
catch (Exception)
catch (Exception ex)
{
// Intentionally empty
return string.Format(CodeAnalysisResources.AnalyzerDriverThrowsDescription, ex.CreateDiagnosticDescription());
}

if (diagnosticIds.IsEmpty)
Expand Down

0 comments on commit 45fbb55

Please sign in to comment.