private void GetVisualStudioConfiguration(out string solutionDir, out string platformName, out string configurationName) { var logger = new ActivityLogLogger(this, () => OutputMode.Verbose); solutionDir = platformName = configurationName = null; try { if (GetService(typeof(DTE)) is DTE dte) { try { solutionDir = Path.GetDirectoryName(dte.Solution.FullName); } catch (Exception e) { logger.LogError($"Exception caught while receiving solution dir from VS instance. dte.Solution.FullName: {dte.Solution.FullName}. Exception:{Environment.NewLine}{e}"); } if (dte.Solution.Projects.Count > 0) { var configurationManager = dte.Solution.Projects.Item(1).ConfigurationManager; var activeConfiguration = configurationManager.ActiveConfiguration; platformName = activeConfiguration.PlatformName; configurationName = activeConfiguration.ConfigurationName; } } } catch (Exception e) { logger.LogError($"Exception while receiving configuration info from Visual Studio.{Environment.NewLine}{e}"); } }
protected override void Initialize() { base.Initialize(); var componentModel = (IComponentModel)GetGlobalService(typeof(SComponentModel)); _globalRunSettings = componentModel.GetService <IGlobalRunSettingsInternal>(); _generalOptions = (GeneralOptionsDialogPage)GetDialogPage(typeof(GeneralOptionsDialogPage)); _parallelizationOptions = (ParallelizationOptionsDialogPage)GetDialogPage(typeof(ParallelizationOptionsDialogPage)); _googleTestOptions = (GoogleTestOptionsDialogPage)GetDialogPage(typeof(GoogleTestOptionsDialogPage)); _globalRunSettings.RunSettings = GetRunSettingsFromOptionPages(); _generalOptions.PropertyChanged += OptionsChanged; _parallelizationOptions.PropertyChanged += OptionsChanged; _googleTestOptions.PropertyChanged += OptionsChanged; SwitchCatchExceptionsOptionCommand.Initialize(this); SwitchBreakOnFailureOptionCommand.Initialize(this); SwitchParallelExecutionOptionCommand.Initialize(this); SwitchPrintTestOutputOptionCommand.Initialize(this); var thread = new Thread(DisplayReleaseNotesIfNecessary); thread.SetApartmentState(ApartmentState.STA); thread.Start(); var logger = new ActivityLogLogger(this, () => _generalOptions.DebugMode); var debuggerAttacher = new VsDebuggerAttacher(this); _debuggerAttacherService = new DebuggerAttacherService(_debuggingNamedPipeId, debuggerAttacher, logger); }
private void InitializeDebuggerAttacherService() { var logger = new ActivityLogLogger(this, () => _generalOptions.DebugMode); var debuggerAttacher = new VsDebuggerAttacher(this); _debuggerAttacherServiceHost = new DebuggerAttacherServiceHost(_debuggingNamedPipeId, debuggerAttacher, logger); try { _debuggerAttacherServiceHost.Open(); } catch (CommunicationException) { _debuggerAttacherServiceHost.Abort(); _debuggerAttacherServiceHost = null; } }
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await base.InitializeAsync(cancellationToken, progress); var componentModel = await GetServiceAsync(typeof(SComponentModel)) as IComponentModel; _globalRunSettings = componentModel.GetService <IGlobalRunSettingsInternal>(); await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _generalOptions = (GeneralOptionsDialogPage)GetDialogPage(typeof(GeneralOptionsDialogPage)); _parallelizationOptions = (ParallelizationOptionsDialogPage)GetDialogPage(typeof(ParallelizationOptionsDialogPage)); _googleTestOptions = (GoogleTestOptionsDialogPage)GetDialogPage(typeof(GoogleTestOptionsDialogPage)); _globalRunSettings.RunSettings = GetRunSettingsFromOptionPages(); _generalOptions.PropertyChanged += OptionsChanged; _parallelizationOptions.PropertyChanged += OptionsChanged; _googleTestOptions.PropertyChanged += OptionsChanged; SwitchCatchExceptionsOptionCommand.Initialize(this); SwitchBreakOnFailureOptionCommand.Initialize(this); SwitchParallelExecutionOptionCommand.Initialize(this); SwitchPrintTestOutputOptionCommand.Initialize(this); DisplayReleaseNotesIfNecessary(); var logger = new ActivityLogLogger(this, () => _generalOptions.DebugMode); var debuggerAttacher = new VsDebuggerAttacher(this); _debuggerAttacherServiceHost = new DebuggerAttacherServiceHost(_debuggingNamedPipeId, debuggerAttacher, logger); try { _debuggerAttacherServiceHost.Open(); } catch (CommunicationException) { _debuggerAttacherServiceHost.Abort(); _debuggerAttacherServiceHost = null; } }