/// <summary> /// make sure solution cralwer is registered for the given workspace. /// </summary> /// <param name="workspace"><see cref="Workspace"/> this solution crawler runs for</param> /// <param name="initializeLazily"> /// when true, solution crawler will be initialized when there is the first workspace event fired. /// otherwise, it will be initialized when workspace is registered right away. /// something like "Build" will use initializeLazily:false to make sure diagnostic analyzer engine (incremental analyzer) /// is initialized. otherwise, if build is called before workspace is fully populated, we will think some errors from build /// doesn't belong to us since diagnostic analyzer engine is not there yet and /// let project system to take care of these unknown errors. /// </param> public void EnsureRegistration(Workspace workspace, bool initializeLazily) { Contract.ThrowIfNull(workspace.Kind); var correlationId = LogAggregator.GetNextId(); lock (_gate) { if (_documentWorkCoordinatorMap.ContainsKey(workspace)) { // already registered. return; } var coordinator = new WorkCoordinator( _listener, GetAnalyzerProviders(workspace.Kind), initializeLazily, new Registration(correlationId, workspace, _progressReporter)); _documentWorkCoordinatorMap.Add(workspace, coordinator); } SolutionCrawlerLogger.LogRegistration(correlationId, workspace); }
public void Register(Workspace workspace) { var correlationId = LogAggregator.GetNextId(); lock (this.gate) { if (this.documentWorkCoordinatorMap.ContainsKey(workspace)) { // already registered. return; } var coordinator = new WorkCoordinator( this.listener, this.analyzerProviders.Where(l => l.Metadata.WorkspaceKinds.Any(wk => wk == workspace.Kind)), correlationId, workspace); this.documentWorkCoordinatorMap.Add(workspace, coordinator); } SolutionCrawlerLogger.LogRegistration(correlationId, workspace); }
public void Register(Workspace workspace) { var correlationId = LogAggregator.GetNextId(); lock (_gate) { if (_documentWorkCoordinatorMap.ContainsKey(workspace)) { // already registered. return; } var coordinator = new WorkCoordinator( _listener, GetAnalyzerProviders(workspace), new Registration(correlationId, workspace, _progressReporter)); _documentWorkCoordinatorMap.Add(workspace, coordinator); } SolutionCrawlerLogger.LogRegistration(correlationId, workspace); }