diff --git a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs index 475b16d956..8fe900e028 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs @@ -20,7 +20,9 @@ public static class FakesUtilities { private const string ConfiguratorAssemblyQualifiedName = "Microsoft.VisualStudio.TestPlatform.Fakes.FakesDataCollectorConfiguration"; - private const string ConfiguratorMethodName = "GetDataCollectorSettingsOrDefault"; + private const string NetFrameworkConfiguratorMethodName = "GetDataCollectorSettingsOrDefault"; + + private const string CrossPlatformConfiguratorMethodName = "GetCrossPlatformDataCollectorSettings"; private const string FakesConfiguratorAssembly = "Microsoft.VisualStudio.TestPlatform.Fakes, Version=16.0.0.0, Culture=neutral"; @@ -85,11 +87,11 @@ private static bool TryAddFakesDataCollectorSettings( // using the CLRIE profiler, and the old involves using the Intellitrace profiler (which isn't supported in // .NET Core scenarios). The old API still exists for fallback measures. - var newConfigurator = TryGetFakesNewDataCollectorConfigurator(); - if (newConfigurator != null) + var crossPlatformConfigurator = TryGetFakesCrossPlatformDataCollectorConfigurator(); + if (crossPlatformConfigurator != null) { var sourceTFMMap = CreateDictionary(sources, framework); - var fakesSettings = newConfigurator(sourceTFMMap); + var fakesSettings = crossPlatformConfigurator(sourceTFMMap); // if no fakes, return settings unchanged if (fakesSettings == null) { @@ -132,14 +134,14 @@ private static bool AddFallbackFakesSettings( return false; } - Func, string> oldConfigurator = TryGetFakesDataCollectorConfigurator(); - if (oldConfigurator == null) + Func, string> netFrameworkConfigurator = TryGetNetFrameworkFakesDataCollectorConfigurator(); + if (netFrameworkConfigurator == null) { return false; } // if no fakes, return settings unchanged - var fakesConfiguration = oldConfigurator(sources); + var fakesConfiguration = netFrameworkConfigurator(sources); if (fakesConfiguration == null) { return false; @@ -184,14 +186,14 @@ private static void EnsureSettingsNode(XmlDocument settings, TestRunSettings set } } - private static Func, string> TryGetFakesDataCollectorConfigurator() + private static Func, string> TryGetNetFrameworkFakesDataCollectorConfigurator() { #if NET451 try { Assembly assembly = Assembly.Load(FakesConfiguratorAssembly); var type = assembly?.GetType(ConfiguratorAssemblyQualifiedName, false); - var method = type?.GetMethod(ConfiguratorMethodName, new Type[] { typeof(IEnumerable) }); + var method = type?.GetMethod(NetFrameworkConfiguratorMethodName, new Type[] { typeof(IEnumerable) }); if (method != null) { return (Func, string>)method.CreateDelegate(typeof(Func, string>)); @@ -208,13 +210,13 @@ private static Func, string> TryGetFakesDataCollectorConfigu return null; } - private static Func, DataCollectorSettings> TryGetFakesNewDataCollectorConfigurator() + private static Func, DataCollectorSettings> TryGetFakesCrossPlatformDataCollectorConfigurator() { try { Assembly assembly = Assembly.Load(FakesConfiguratorAssembly); var type = assembly?.GetType(ConfiguratorAssemblyQualifiedName, false); - var method = type?.GetMethod(ConfiguratorMethodName, new Type[] { typeof(IDictionary) }); + var method = type?.GetMethod(CrossPlatformConfiguratorMethodName, new Type[] { typeof(IDictionary) }); if (method != null) { return (Func, DataCollectorSettings>)method.CreateDelegate(typeof(Func, DataCollectorSettings>));