/// <summary> /// Register a workspace as the primary workspace. Only one workspace can be the primary. /// </summary> public static void Register(Workspace workspace) { if (workspace == null) { throw new ArgumentNullException(nameof(workspace)); } using (s_registryGate.DisposableWrite()) { s_primaryWorkspace = workspace; foreach (var taskSource in s_primaryWorkspaceTaskSourceList) { try { taskSource.TrySetResult(workspace); } catch { } } s_primaryWorkspaceTaskSourceList.Clear(); } }
public void Stop() { using (_stateLock.DisposableWrite()) { if (IsStarted) { CancelAllParses_NoLock(); IsStarted = false; } } }
// Simply add a syntax/bound pair to the map. private void AddBoundNodeToMap(SyntaxNode syntax, BoundNode bound) { using (nodeMapLock.DisposableWrite()) { // Suppose we have bound a subexpression, say "x", and have cached the result in the // map. Later on, we bind the parent expression, "x + y" and end up re-binding x. In // this situation we do not want to clobber the existing "x" in the map because x // might be a complex expression that contains lambda symbols (or, equivalently, // lambda parameter symbols). We want to make sure we always get the same symbols // out of the cache every time we ask. if (!this.guardedNodeMap.ContainsKey(syntax)) { this.guardedNodeMap.Add(syntax, bound); } } }
public void DisconnectFromVisualStudioNativeServices() { using (_readerWriterLock.DisposableWrite()) { // IVsSmartOpenScope can't be used as we shutdown, and this is pretty commonly hit according to // Windows Error Reporting as we try creating metadata for compilations. SmartOpenScopeServiceOpt = null; } }
/// <summary> /// Register a workspace as the primary workspace. Only one workspace can be the primary. /// </summary> public void Register(Workspace workspace) { if (workspace == null) { throw new ArgumentNullException(nameof(workspace)); } using (_registryGate.DisposableWrite()) { _primaryWorkspace = workspace; } }
public void Dispose() { using (_shutdownLock.DisposableWrite()) { _isDisposed = true; foreach (var(_, pool) in _pools) { pool.DisposeConnections(); } _pools.Clear(); } }
private static void BindSyntaxTreeToId(SyntaxTreeBase tree, DocumentId id) { using (s_syntaxTreeToIdMapLock.DisposableWrite()) { if (s_syntaxTreeToIdMap.TryGetValue(tree, out var existingId)) { Contract.ThrowIfFalse(existingId == id); } else { s_syntaxTreeToIdMap.Add(tree, id); } } }
public void Dispose() { using (_shutdownLock.DisposableWrite()) { _isDisposed = true; // let all connections in the pool to go away foreach (var(_, queue) in _pools) { while (queue.TryDequeue(out var connection)) { connection.Dispose(); } } _pools.Clear(); } }
public void Shutdown() { using (_shutdownLock.DisposableWrite()) { // let ref count this one is holding go _remotableDataRpc.Dispose(); // let all connections in the pool to go away foreach (var(_, queue) in _pools) { while (queue.TryDequeue(out var connection)) { connection.Dispose(); } } _pools.Clear(); } }
private async Task UpdateVersionCacheAsync(Project project, VersionStamp version, CompilationSet?primarySet, CancellationToken cancellationToken) { var versionMap = GetVersionMapFromBranch(project.Solution.Workspace, project.Solution.BranchId); if (!AlreadyHasLatestCompilationSet(versionMap, project.Id, version, out var compilationSet) || !compilationSet.Compilation.TryGetValue(out var compilationOpt) || !compilationOpt.HasValue) { var newSet = await CompilationSet.CreateAsync(project, compilationSet ?? primarySet, cancellationToken).ConfigureAwait(false); using (_gate.DisposableWrite()) { // we still don't have it or if someone has beaten us, check what we have is newer if (!versionMap.TryGetValue(project.Id, out compilationSet) || version != compilationSet.Version) { versionMap[project.Id] = newSet; } } } }
public void Dispose() { using (_shutdownLock.DisposableWrite()) { _isDisposed = true; // let ref count this one is holding go _remotableDataProvider.Dispose(); // let all connections in the pool to go away foreach (var(_, queue) in _pools) { while (queue.TryDequeue(out var connection)) { connection.Dispose(); } } _pools.Clear(); } _hubClient.Dispose(); }