Skip to content

Commit adfea8e

Browse files
[main] Source code updates from microsoft/vstest (#1871)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
1 parent 67eac9b commit adfea8e

File tree

4 files changed

+11
-103
lines changed

4 files changed

+11
-103
lines changed

src/source-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@
127127
"commitSha": "b67630f060f02a6f5ef7cfcea731dce0d13e1ad6"
128128
},
129129
{
130-
"barId": 278691,
130+
"barId": 278912,
131131
"path": "vstest",
132132
"remoteUri": "https://github.com/microsoft/vstest",
133-
"commitSha": "829937612b95e623785d2e0bb970395676d22b4d"
133+
"commitSha": "4d2e4b05ee14d1b06d0029c97c1109ba8d09e93a"
134134
},
135135
{
136136
"barId": 278644,

src/vstest/eng/Version.Details.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This file should be imported by eng/Versions.props
99
<!-- _git/vs-code-coverage dependencies -->
1010
<MicrosoftInternalCodeCoveragePackageVersion>17.15.0-preview.25354.5</MicrosoftInternalCodeCoveragePackageVersion>
1111
<!-- dotnet/dotnet dependencies -->
12-
<MicrosoftDiagnosticsNETCoreClientPackageVersion>0.2.0-preview.25409.103</MicrosoftDiagnosticsNETCoreClientPackageVersion>
12+
<MicrosoftDiagnosticsNETCoreClientPackageVersion>0.2.0-preview.25410.101</MicrosoftDiagnosticsNETCoreClientPackageVersion>
1313
<!-- dotnet/runtime dependencies -->
1414
<MicrosoftExtensionsDependencyModelPackageVersion>6.0.2</MicrosoftExtensionsDependencyModelPackageVersion>
1515
<SystemComponentModelCompositionPackageVersion>4.5.0</SystemComponentModelCompositionPackageVersion>

src/vstest/eng/Version.Details.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
3-
<Source Uri="https://github.com/dotnet/dotnet" Mapping="vstest" Sha="e9f665e52848a3615736c099e5631af531b66a5c" BarId="278626" />
3+
<Source Uri="https://github.com/dotnet/dotnet" Mapping="vstest" Sha="8c7b3dcd2bd657c11b12973f1214e7c3c616b174" BarId="278647" />
44
<ProductDependencies>
55
<Dependency Name="Microsoft.Internal.CodeCoverage" Version="17.15.0-preview.25354.5">
66
<Uri>https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage</Uri>
77
<Sha>b3c8a0e7de26919a4efd2a347133522dca5b8ee6</Sha>
88
</Dependency>
9-
<Dependency Name="Microsoft.Diagnostics.NETCore.Client" Version="0.2.0-preview.25409.103">
9+
<Dependency Name="Microsoft.Diagnostics.NETCore.Client" Version="0.2.0-preview.25410.101">
1010
<Uri>https://github.com/dotnet/dotnet</Uri>
11-
<Sha>e9f665e52848a3615736c099e5631af531b66a5c</Sha>
11+
<Sha>8c7b3dcd2bd657c11b12973f1214e7c3c616b174</Sha>
1212
</Dependency>
1313
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
1414
<Dependency Name="System.ComponentModel.Composition" Version="4.5.0">

src/vstest/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs

Lines changed: 5 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ private static bool TryAddFakesDataCollectorSettings(
9797
IEnumerable<string> sources,
9898
FrameworkVersion framework)
9999
{
100-
// A new Fakes Configurator API makes the decision to add the right datacollector uri to the configuration
101-
// There now exist two data collector URIs to support two different scenarios. The new scenario involves
102-
// using the CLRIE profiler, and the old involves using the Intellitrace profiler (which isn't supported in
103-
// .NET Core scenarios). The old API still exists for fallback measures.
104-
100+
// Only cross-platform (v2) Fakes is supported. Fallback to v1 is removed.
105101
var crossPlatformConfigurator = TryGetFakesCrossPlatformDataCollectorConfigurator();
106102
if (crossPlatformConfigurator != null)
107103
{
@@ -118,7 +114,8 @@ private static bool TryAddFakesDataCollectorSettings(
118114
return true;
119115
}
120116

121-
return AddFallbackFakesSettings(runSettings, sources, framework);
117+
// Fakes v1 fallback support removed.
118+
return false;
122119
}
123120

124121
internal static void InsertOrReplaceFakesDataCollectorNode(XmlDocument runSettings, DataCollectorSettings settings)
@@ -157,55 +154,6 @@ private static IDictionary<string, FrameworkVersion> CreateDictionary(IEnumerabl
157154
return dict;
158155
}
159156

160-
private static bool AddFallbackFakesSettings(
161-
XmlDocument runSettings,
162-
IEnumerable<string> sources,
163-
FrameworkVersion framework)
164-
{
165-
166-
// The fallback settings is for the old implementation of fakes
167-
// that only supports .Net Framework versions
168-
if (framework
169-
is not FrameworkVersion.Framework35
170-
and not FrameworkVersion.Framework40
171-
and not FrameworkVersion.Framework45)
172-
{
173-
return false;
174-
}
175-
176-
Func<IEnumerable<string>, string>? netFrameworkConfigurator = TryGetNetFrameworkFakesDataCollectorConfigurator();
177-
if (netFrameworkConfigurator == null)
178-
{
179-
return false;
180-
}
181-
182-
// if no fakes, return settings unchanged
183-
var fakesConfiguration = netFrameworkConfigurator(sources);
184-
if (fakesConfiguration == null)
185-
{
186-
return false;
187-
}
188-
189-
// integrate fakes settings in configuration
190-
// if the settings don't have any data collector settings, populate with empty settings
191-
EnsureSettingsNode(runSettings, new DataCollectionRunSettings());
192-
193-
// embed fakes settings
194-
var fakesSettings = CreateFakesDataCollectorSettings();
195-
var doc = new XmlDocument();
196-
using (var xmlReader = XmlReader.Create(
197-
new StringReader(fakesConfiguration),
198-
new XmlReaderSettings() { CloseInput = true }))
199-
{
200-
doc.Load(xmlReader);
201-
}
202-
203-
fakesSettings.Configuration = doc.DocumentElement;
204-
XmlRunSettingsUtilities.InsertDataCollectorsNode(runSettings.CreateNavigator()!, fakesSettings);
205-
206-
return true;
207-
}
208-
209157
/// <summary>
210158
/// Ensures that an xml element corresponding to the test run settings exists in the setting document.
211159
/// </summary>
@@ -225,27 +173,6 @@ private static void EnsureSettingsNode(XmlDocument settings, TestRunSettings set
225173
}
226174
}
227175

228-
private static Func<IEnumerable<string>, string>? TryGetNetFrameworkFakesDataCollectorConfigurator()
229-
{
230-
#if NETFRAMEWORK
231-
try
232-
{
233-
var assembly = LoadTestPlatformAssembly();
234-
var type = assembly?.GetType(ConfiguratorAssemblyQualifiedName, false);
235-
var method = type?.GetMethod(NetFrameworkConfiguratorMethodName, [typeof(IEnumerable<string>)]);
236-
if (method != null)
237-
{
238-
return (Func<IEnumerable<string>, string>)method.CreateDelegate(typeof(Func<IEnumerable<string>, string>));
239-
}
240-
}
241-
catch (Exception ex)
242-
{
243-
EqtTrace.Info("Failed to create Fakes Configurator. Reason:{0} ", ex);
244-
}
245-
#endif
246-
return null;
247-
}
248-
249176
private static Func<IDictionary<string, FrameworkVersion>, DataCollectorSettings>? TryGetFakesCrossPlatformDataCollectorConfigurator()
250177
{
251178
try
@@ -279,25 +206,6 @@ private static void EnsureSettingsNode(XmlDocument settings, TestRunSettings set
279206
return null;
280207
}
281208

282-
/// <summary>
283-
/// Adds the Fakes data collector settings in the run settings document.
284-
/// </summary>
285-
/// <returns>
286-
/// The <see cref="DataCollectorSettings"/>.
287-
/// </returns>
288-
private static DataCollectorSettings CreateFakesDataCollectorSettings()
289-
{
290-
// embed the fakes run settings
291-
var settings = new DataCollectorSettings
292-
{
293-
AssemblyQualifiedName = FakesMetadata.DataCollectorAssemblyQualifiedName,
294-
FriendlyName = FakesMetadata.FriendlyName,
295-
IsEnabled = true,
296-
Uri = new Uri(FakesMetadata.DataCollectorUriV1)
297-
};
298-
return settings;
299-
}
300-
301209
internal static class FakesMetadata
302210
{
303211
/// <summary>
@@ -306,12 +214,12 @@ internal static class FakesMetadata
306214
public const string FriendlyName = "UnitTestIsolation";
307215

308216
/// <summary>
309-
/// Gets the URI of the data collector
217+
/// Gets the URI of the data collector (V1, deprecated and removed)
310218
/// </summary>
311219
public const string DataCollectorUriV1 = "datacollector://microsoft/unittestisolation/1.0";
312220

313221
/// <summary>
314-
/// Gets the URI of the data collector
222+
/// Gets the URI of the data collector (V2)
315223
/// </summary>
316224
public const string DataCollectorUriV2 = "datacollector://microsoft/unittestisolation/2.0";
317225

0 commit comments

Comments
 (0)