Skip to content

Add Process.WaitForExit(TimeSpan) polyfill (NET 7.0)#119

Merged
Tyrrrz merged 3 commits intoprimefrom
copilot/add-polyfill-for-waitforexit-overloads
Apr 17, 2026
Merged

Add Process.WaitForExit(TimeSpan) polyfill (NET 7.0)#119
Tyrrrz merged 3 commits intoprimefrom
copilot/add-polyfill-for-waitforexit-overloads

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

Process.WaitForExit(TimeSpan timeout) was introduced in .NET 7.0 and is not available on older TFMs. This adds a polyfill so it can be used on .NET Framework, .NET Standard, and pre-7.0 .NET Core targets.

Changes

  • PolyShim/Net70/Process.cs — Extension method polyfill for Process.WaitForExit(TimeSpan), guarded by FEATURE_PROCESS and !NET7_0_OR_GREATER. Validates the TimeSpan is within the [-1, int.MaxValue] ms range (matching the native API contract), then delegates to WaitForExit(int).
  • PolyShim.Tests/Net70/ProcessTests.cs — Two tests covering the success (process exits within timeout) and timeout-elapsed (returns false) paths.
using var process = Process.Start("my-tool");

// Now usable on all supported TFMs
bool exited = process.WaitForExit(TimeSpan.FromSeconds(30));

@Tyrrrz Tyrrrz added the enhancement New feature or request label Apr 17, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 17, 2026 10:32
Copilot AI review requested due to automatic review settings April 17, 2026 10:32
Comment thread PolyShim.Tests/Net70/ProcessTests.cs Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.81%. Comparing base (950c84c) to head (39cdcdc).
⚠️ Report is 1 commits behind head on prime.

Files with missing lines Patch % Lines
PolyShim/Net70/Process.cs 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            prime     #119      +/-   ##
==========================================
+ Coverage   90.75%   90.81%   +0.06%     
==========================================
  Files         282      284       +2     
  Lines        4898     4934      +36     
  Branches      401      404       +3     
==========================================
+ Hits         4445     4481      +36     
+ Misses        364      363       -1     
- Partials       89       90       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a PolyShim polyfill for System.Diagnostics.Process.WaitForExit(TimeSpan) (introduced in .NET 7) so callers can use the TimeSpan overload on older target frameworks, along with tests and signature documentation updates.

Changes:

  • Add Process.WaitForExit(TimeSpan) polyfill (guarded by FEATURE_PROCESS and !NET7_0_OR_GREATER) delegating to WaitForExit(int).
  • Add Net70 tests intended to cover “exits within timeout” and “timeout elapsed” behaviors.
  • Update Signatures.md to include the new member and adjust totals.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
Signatures.md Documents the added Process.WaitForExit(TimeSpan) member and updates counts.
PolyShim/Net70/Process.cs Implements the WaitForExit(TimeSpan) polyfill for pre-.NET 7 TFMs.
PolyShim.Tests/Net70/ProcessTests.cs Adds tests for the new TimeSpan overload behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PolyShim.Tests/Net70/ProcessTests.cs Outdated
Comment thread PolyShim/Net70/Process.cs
Comment thread PolyShim.Tests/Net70/ProcessTests.cs Outdated
Comment thread PolyShim.Tests/Net70/ProcessTests.cs
Comment thread PolyShim.Tests/Net70/ProcessTests.cs
Tyrrrz and others added 2 commits April 17, 2026 13:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants