Skip to content

Commit

Permalink
use Timer.CancelAsync from polyfill (#3836)
Browse files Browse the repository at this point in the history
Co-authored-by: Amaury Levé <amauryleve@microsoft.com>
  • Loading branch information
SimonCropp and Evangelink authored Sep 21, 2024
1 parent 32c4e64 commit fdcd3b9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,7 @@ public async Task<int> RunAsyncAndReturnExitCodeAsync(
var timedOut = Task.Delay(TimeSpan.FromSeconds(seconds), stopTheTimer.Token);
if (await Task.WhenAny(exited, timedOut) == exited)
{
#if NET8_0_OR_GREATER
await stopTheTimer.CancelAsync();
#else
#pragma warning disable VSTHRD103 // Call async methods when in an async method
stopTheTimer.Cancel();
#pragma warning restore VSTHRD103 // Call async methods when in an async method
#endif
return await exited;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
<ProjectCapability Remove="TestingPlatformServer" />
</ItemGroup>

<ItemGroup>
<Using Include="Polyfills" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

using System.Diagnostics;

#if NETSTANDARD
using Polyfills;
#endif

namespace Microsoft.Testing.TestInfrastructure;

public sealed class ProcessHandle : IProcessHandle, IDisposable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using System.Text;
using System.Xml.Linq;

using Polyfills;

namespace Microsoft.Testing.TestInfrastructure;

public class VSSolution : Folder
Expand Down

0 comments on commit fdcd3b9

Please sign in to comment.