/// <summary> /// The get data collector launcher. /// </summary> /// <returns> /// The <see cref="IDataCollectionLauncher"/>. /// </returns> internal static IDataCollectionLauncher GetDataCollectorLauncher(IProcessHelper processHelper, string settingsXml) { // Always launch datacollector.exe if code coverage is configured. if (!string.IsNullOrWhiteSpace(settingsXml)) { var dataCollectionRunSettings = XmlRunSettingsUtilities.GetDataCollectionRunSettings(settingsXml); foreach (var dataCollectorSettings in dataCollectionRunSettings.DataCollectorSettingsList) { if (string.Equals(dataCollectorSettings.FriendlyName, "event Log", StringComparison.OrdinalIgnoreCase) || string.Equals(dataCollectorSettings.Uri?.ToString(), @"datacollector://Microsoft/EventLog/2.0", StringComparison.OrdinalIgnoreCase)) { return(new DefaultDataCollectionLauncher()); } } } // Target Framework of DataCollection process and Runner should be same. var currentProcessPath = processHelper.GetCurrentProcessFileName(); if (currentProcessPath.EndsWith("dotnet", StringComparison.OrdinalIgnoreCase) || currentProcessPath.EndsWith("dotnet.exe", StringComparison.OrdinalIgnoreCase)) { return(new DotnetDataCollectionLauncher()); } return(new DefaultDataCollectionLauncher()); }
/// <summary> /// The get data collector launcher. /// </summary> /// <returns> /// The <see cref="IDataCollectionLauncher"/>. /// </returns> internal static IDataCollectionLauncher GetDataCollectorLauncher(IProcessHelper processHelper) { // Target Framework of DataCollection process and Runner should be same. var currentProcessPath = processHelper.GetCurrentProcessFileName(); if (currentProcessPath.EndsWith("dotnet", StringComparison.OrdinalIgnoreCase) || currentProcessPath.EndsWith("dotnet.exe", StringComparison.OrdinalIgnoreCase)) { return(new DotnetDataCollectionLauncher()); } return(new DefaultDataCollectionLauncher()); }