Ejemplo n.º 1
0
        public void InitializeGlobalState(string host, int uiCultureLCID, int cultureLCID, string?serializedSession, CancellationToken cancellationToken)
        {
            RunService(() =>
            {
                // initialize global asset storage
                AssetStorage.Initialize(this);

                // serializedSession may be null for testing
                if (serializedSession != null)
                {
                    SetGlobalContext(uiCultureLCID, cultureLCID, serializedSession);
                }

                // log telemetry that service hub started
                RoslynLogger.Log(FunctionId.RemoteHost_Connect, KeyValueLogMessage.Create(m =>
                {
                    m["Host"]       = host;
                    m["InstanceId"] = InstanceId;
                }));

                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;
                }
            }, cancellationToken);
        }
Ejemplo n.º 2
0
        public void InitializeGlobalState(int uiCultureLCID, int cultureLCID, CancellationToken cancellationToken)
        {
            RunService(() =>
            {
                // initialize global asset storage
                AssetStorage.Initialize(this);

                if (uiCultureLCID != 0)
                {
                    EnsureCulture(uiCultureLCID, cultureLCID);
                }
            }, cancellationToken);
        }
Ejemplo n.º 3
0
        public string Connect(string host, int uiCultureLCID, int cultureLCID, string?serializedSession, CancellationToken cancellationToken)
        {
            return(RunService(() =>
            {
                cancellationToken.ThrowIfCancellationRequested();

                // initialize global assert storage
                AssetStorage.Initialize(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));
        }