diff --git a/samples/Playground/Playground.csproj b/samples/Playground/Playground.csproj
index dbf0ad2fc3..3428cb96e1 100644
--- a/samples/Playground/Playground.csproj
+++ b/samples/Playground/Playground.csproj
@@ -34,4 +34,10 @@
+
+
+
+
+
+
diff --git a/samples/Playground/Program.cs b/samples/Playground/Program.cs
index 6e138d7392..5454539f68 100644
--- a/samples/Playground/Program.cs
+++ b/samples/Playground/Program.cs
@@ -4,8 +4,11 @@
using System.Reflection;
using Microsoft.Testing.Platform.Builder;
+using Microsoft.Testing.Platform.ServerMode.IntegrationTests.Messages.V100;
using Microsoft.VisualStudio.TestTools.UnitTesting;
+using MSTest.Acceptance.IntegrationTests.Messages.V100;
+
namespace Playground;
public class Program
@@ -15,8 +18,12 @@ public static async Task Main(string[] args)
// Opt-out telemetry
Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
- ITestApplicationBuilder testApplicationBuilder = await TestApplication.CreateBuilderAsync(args);
- testApplicationBuilder.AddMSTest(() => [Assembly.GetEntryAssembly()!]);
+ if (Environment.GetEnvironmentVariable("TESTSERVERMODE") != "1")
+ {
+ // To attach to the children
+ // Microsoft.Testing.TestInfrastructure.DebuggerUtility.AttachCurrentProcessToParentVSProcess();
+ ITestApplicationBuilder testApplicationBuilder = await TestApplication.CreateBuilderAsync(args);
+ testApplicationBuilder.AddMSTest(() => [Assembly.GetEntryAssembly()!]);
// Enable Trx
// testApplicationBuilder.AddTrxReportProvider();
@@ -40,10 +47,7 @@ public static async Task Main(string[] args)
});
await discoveryResponse.WaitCompletionAsync();
- ResponseListener runRequest = await client.RunTestsAsync(Guid.NewGuid(), testNodeUpdates.Select(x => x.Node).ToArray(), node =>
- {
- return Task.CompletedTask;
- });
+ ResponseListener runRequest = await client.RunTestsAsync(Guid.NewGuid(), testNodeUpdates.Select(x => x.Node).ToArray(), node => Task.CompletedTask);
await runRequest.WaitCompletionAsync();
await client.ExitAsync();
diff --git a/samples/Playground/ServerMode/TestingPlatformClientFactory.cs b/samples/Playground/ServerMode/TestingPlatformClientFactory.cs
index 07333c78b5..6be2ce74ef 100644
--- a/samples/Playground/ServerMode/TestingPlatformClientFactory.cs
+++ b/samples/Playground/ServerMode/TestingPlatformClientFactory.cs
@@ -258,7 +258,10 @@ public static IProcessHandle Start(ProcessConfiguration config, bool cleanDefaul
ProcessHandleInfo processHandleInfo = new();
ProcessHandle processHandle = new(process, processHandleInfo);
- process.Exited += (s, e) => config.OnExit?.Invoke(processHandle, process.ExitCode);
+ if (config.OnExit != null)
+ {
+ process.Exited += (s, e) => config.OnExit.Invoke(processHandle, process.ExitCode);
+ }
if (config.OnStandardOutput != null)
{
@@ -345,16 +348,12 @@ internal ProcessHandle(Process process, ProcessHandleInfo processHandleInfo)
public async Task WaitForExitAsync()
{
- if (_disposed)
+ if (!_disposed)
{
- return _exitCode;
+ await _process.WaitForExitAsync();
}
-#if NETCOREAPP
- await _process.WaitForExitAsync();
-#else
- _process.WaitForExit();
-#endif
- return await Task.FromResult(_process.ExitCode);
+
+ return _exitCode;
}
public void WaitForExit() => _process.WaitForExit();
@@ -413,11 +412,7 @@ private static void KillSafe(Process process)
{
try
{
-#if NETCOREAPP
process.Kill(true);
-#else
- process.Kill();
-#endif
}
catch (InvalidOperationException)
{
diff --git a/samples/Playground/Tests.cs b/samples/Playground/Tests.cs
index 4c56d5579e..4efee61a74 100644
--- a/samples/Playground/Tests.cs
+++ b/samples/Playground/Tests.cs
@@ -12,8 +12,20 @@ namespace Playground;
[TestClass]
public class TestClass
{
+ public TestContext TestContext { get; set; } = null!;
+
[TestMethod]
public void Test()
{
}
+
+ [TestMethod]
+ public void Test2()
+ {
+ }
+
+ [TestMethod]
+ public void Test3()
+ {
+ }
}