Skip to content

Instantly share code, notes, and snippets.

@joymon
Last active August 29, 2015 14:22
Show Gist options
  • Save joymon/508f47e2cd50cf54bf06 to your computer and use it in GitHub Desktop.
Save joymon/508f47e2cd50cf54bf06 to your computer and use it in GitHub Desktop.
public async void TestRoslynCompilationWithAnalyzers()
{
Compilation compilation = GetSimpleCompilation();
CompilationWithAnalyzers compilationWithAnalyzers = GetAnalyzerAwareCompilation(compilation);
ImmutableArray<Diagnostic> diagnosticResults = await compilationWithAnalyzers.GetAllDiagnosticsAsync();
if (diagnosticResults.Length == 0)
{
ImmutableArray<Diagnostic> diagnostics = Compile(compilationWithAnalyzers.Compilation);
ShowDiagnostics(diagnostics);
}
else
{
ShowDiagnostics(diagnosticResults);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment