public string Connect(string host, int uiCultureLCID, int cultureLCID, string?serializedSession, CancellationToken cancellationToken) { return(RunService(() => { cancellationToken.ThrowIfCancellationRequested(); AssetStorage.SetAssetSource(this); _primaryInstance = InstanceId; var existing = Interlocked.CompareExchange(ref _host, host, null); // serializedSession may be null for testing if (serializedSession != null) { SetGlobalContext(uiCultureLCID, cultureLCID, serializedSession); } if (existing != null && existing != host) { Log(TraceEventType.Error, $"{host} is given for {existing}"); } // log telemetry that service hub started RoslynLogger.Log(FunctionId.RemoteHost_Connect, KeyValueLogMessage.Create(SetSessionInfo)); if (serializedSession != null) { // Set this process's priority BelowNormal. // this should let us to freely try to use all resources possible without worrying about affecting // host's work such as responsiveness or build. Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal; } return _host; }, cancellationToken)); }
protected AssetSource(AssetStorage assetStorage) { _assetStorage = assetStorage; _assetStorage.SetAssetSource(this); }