public DiagnosticIncrementalAnalyzer(
            DiagnosticAnalyzerService analyzerService,
            int correlationId,
            Workspace workspace,
            HostDiagnosticAnalyzers hostAnalyzers,
            DiagnosticAnalyzerInfoCache analyzerInfoCache,
            AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource)
        {
            Contract.ThrowIfNull(analyzerService);

            AnalyzerService             = analyzerService;
            Workspace                   = workspace;
            HostAnalyzers               = hostAnalyzers;
            DiagnosticAnalyzerInfoCache = analyzerInfoCache;
            HostDiagnosticUpdateSource  = hostDiagnosticUpdateSource;
            PersistentStorageService    = workspace.Services.GetRequiredService <IPersistentStorageService>();

            _correlationId = correlationId;

            _stateManager = new StateManager(hostAnalyzers, PersistentStorageService, analyzerInfoCache);
            _stateManager.ProjectAnalyzerReferenceChanged += OnProjectAnalyzerReferenceChanged;
            _telemetry = new DiagnosticAnalyzerTelemetry();

            _diagnosticAnalyzerRunner         = new InProcOrRemoteHostAnalyzerRunner(analyzerService.Listener, analyzerInfoCache, HostDiagnosticUpdateSource);
            _projectCompilationsWithAnalyzers = new ConditionalWeakTable <Project, CompilationWithAnalyzers?>();
        }
        public DiagnosticIncrementalAnalyzer(
            DiagnosticAnalyzerService analyzerService,
            int correlationId,
            Workspace workspace,
            DiagnosticAnalyzerInfoCache analyzerInfoCache)
        {
            Contract.ThrowIfNull(analyzerService);

            AnalyzerService          = analyzerService;
            Workspace                = workspace;
            _documentTrackingService = workspace.Services.GetRequiredService <IDocumentTrackingService>();

            _correlationId = correlationId;

            _stateManager = new StateManager(workspace, analyzerInfoCache);
            _stateManager.ProjectAnalyzerReferenceChanged += OnProjectAnalyzerReferenceChanged;
            _telemetry = new DiagnosticAnalyzerTelemetry();

            _diagnosticAnalyzerRunner         = new InProcOrRemoteHostAnalyzerRunner(analyzerInfoCache, analyzerService.Listener);
            _projectCompilationsWithAnalyzers = new ConditionalWeakTable <Project, CompilationWithAnalyzers?>();
        }