This project is read-only.

IDiagnosticAnalyzer long running analysis

Topics: APIs
Apr 25, 2014 at 12:00 PM
I've noticed that IDiagnosticAnalyzer derived interfaces do not have async method signatures, for example:
void AnalyzeNode(SyntaxNode node, SemanticModel semanticModel, Action<Diagnostic> addDiagnostic, CancellationToken cancellationToken);
Are all analyzers expected to perform their analysis in synchronous manner? What about a scenario where I would want to perform some long running (possibly IO bound) analysis on my code? How should I implement this? Should I just cache addDiagnostic delegate and call it at a later time being mindfull of CancellationToken?
Apr 25, 2014 at 6:21 PM
The API is hinting that you should not have long running analysis. Since these are meant to be run as part of normal compilation they should be as least impactful on performance as possible.