public void ExecuteWithSettingsForExecutable()

in GoogleTestAdapter/Core/Settings/SettingsWrapper.cs [80:131]


        public void ExecuteWithSettingsForExecutable(string executable, Action action, ILogger logger)
        {
            lock (_lock)
            {
                CheckCorrectUsage(executable);

                _nrOfRunningExecutions++;
                if (_nrOfRunningExecutions == 1)
                {
                    _currentExecutable = executable;
                    _currentThread = Thread.CurrentThread;

                    var projectSettings = _settingsContainer.GetSettingsForExecutable(executable);
                    if (projectSettings != null)
                    {
                        _currentSettings = projectSettings;
                        string settingsString = ToString();
                        _currentSettings = _settingsContainer.SolutionSettings;
                        logger.DebugInfo(String.Format(Resources.SettingsMessage, executable, settingsString));

                        _currentSettings = projectSettings;
                    }
                    else
                    {
                        logger.DebugInfo(String.Format(Resources.NoSettingConfigured, executable, this));
                    }
                }

            }

            try
            {
                action.Invoke();
            }
            finally
            {
                lock (_lock)
                {
                    _nrOfRunningExecutions--;
                    if (_nrOfRunningExecutions == 0)
                    {
                        _currentExecutable = null;
                        _currentThread = null;
                        if (_currentSettings != _settingsContainer.SolutionSettings)
                        {
                            _currentSettings = _settingsContainer.SolutionSettings;
                            logger.DebugInfo(String.Format(Resources.RestoringSolutionSettings, this));
                        }
                    }
                }
            }
        }