/// <summary> /// SessionStart event handler /// </summary> /// <param name="sender">Sender</param> /// <param name="sessionStartEventArgs">Event args</param> private void OnSessionStart(object sender, SessionStartEventArgs sessionStartEventArgs) { _eqtTrace.Verbose("{0}: SessionStart received", CoverletConstants.DataCollectorName); try { // Get coverlet settings IEnumerable <string> testModules = this.GetTestModules(sessionStartEventArgs); var coverletSettingsParser = new CoverletSettingsParser(_eqtTrace); CoverletSettings coverletSettings = coverletSettingsParser.Parse(_configurationElement, testModules); // Build services container _serviceProvider = _serviceCollectionFactory(_eqtTrace, _logger, coverletSettings.TestModule).BuildServiceProvider(); // Get coverage and attachment managers _coverageManager = new CoverageManager(coverletSettings, _eqtTrace, _logger, _coverageWrapper, _serviceProvider.GetRequiredService <IInstrumentationHelper>(), _serviceProvider.GetRequiredService <IFileSystem>(), _serviceProvider.GetRequiredService <ISourceRootTranslator>()); // Instrument modules _coverageManager.InstrumentModules(); } catch (Exception ex) { _logger.LogWarning(ex.ToString()); this.Dispose(true); } }
/// <summary> /// SessionStart event handler /// </summary> /// <param name="sender">Sender</param> /// <param name="sessionStartEventArgs">Event args</param> private void OnSessionStart(object sender, SessionStartEventArgs sessionStartEventArgs) { _eqtTrace.Verbose("{0}: SessionStart received", CoverletConstants.DataCollectorName); try { // Get coverlet settings IEnumerable <string> testModules = this.GetTestModules(sessionStartEventArgs); var coverletSettingsParser = new CoverletSettingsParser(_eqtTrace); CoverletSettings coverletSettings = coverletSettingsParser.Parse(_configurationElement, testModules); // Get coverage and attachment managers _coverageManager = new CoverageManager(coverletSettings, _eqtTrace, _logger, _coverageWrapper); // Instrument modules _coverageManager.InstrumentModules(); } catch (Exception ex) { _logger.LogWarning(ex.ToString()); this.Dispose(true); } }