public void SuppressDuplicateAnalyzerExceptionDiagnostics()
        {
            var exceptionDiagnostics = new HashSet<Diagnostic>();

            VerifyCSharp(@"
public class C
{
}
public class C1
{
}
public class C2
{
}
",
                new[] { new ThrowExceptionForEachNamedTypeAnalyzer() },
                onAnalyzerException: (ex, a, d) => exceptionDiagnostics.Add(d));

            exceptionDiagnostics.Verify(
                Diagnostic("AD0001", null)
                    .WithArguments(
                        "Microsoft.CodeAnalysis.UnitTests.Diagnostics.SuppressMessageAttributeTests+ThrowExceptionForEachNamedTypeAnalyzer",
                        "System.Exception",
                        "ThrowExceptionAnalyzer exception")
                    .WithLocation(1, 1));
        }
        public async Task AnalyzerExceptionDiagnosticsWithDifferentContext()
        {
            var exceptionDiagnostics = new HashSet<Diagnostic>();

            await VerifyCSharpAsync(@"
public class C
{
}
public class C1
{
}
public class C2
{
}
",
                new[] { new ThrowExceptionForEachNamedTypeAnalyzer() },
                onAnalyzerException: (ex, a, d) => exceptionDiagnostics.Add(d));

            var diagnostic = Diagnostic("AD0001", null)
                    .WithArguments(
                        "Microsoft.CodeAnalysis.UnitTests.Diagnostics.SuppressMessageAttributeTests+ThrowExceptionForEachNamedTypeAnalyzer",
                        "System.Exception",
                        "ThrowExceptionAnalyzer exception")
                    .WithLocation(1, 1);

            // expect 3 different diagnostics with 3 different contexts.
            exceptionDiagnostics.Verify(diagnostic, diagnostic, diagnostic);
        }