private IEnumerable<DiagnosticAnalyzer> InstantiateDiagnosticAnalyzers(Assembly analyserAssembly, string language)
{
Debug.Assert(analyserAssembly != null);
List<DiagnosticAnalyzer> analyzers = new List<DiagnosticAnalyzer>();
// It is assumed that analyserAssembly is valid. FileNotFoundException will be thrown if dependency resolution fails.
foreach (Type type in analyserAssembly.GetTypes())
{
if (!type.IsAbstract &&
type.IsSubclassOf(typeof(DiagnosticAnalyzer)) &&
DiagnosticMatchesLanguage(type, language))
{
DiagnosticAnalyzer analyzer = (DiagnosticAnalyzer)Activator.CreateInstance(type);
analyzers.Add(analyzer);
this.logger.LogDebug(UIResources.Scanner_AnalyzerLoaded, analyzer.ToString());
}
}
return analyzers;
}