Add Process.TryGetProcessById and silent param on Run/RunAsync#568
Merged
SimonCropp merged 4 commits intoJul 14, 2026
Merged
Conversation
- Process.TryGetProcessById(int, out Process?) - add `silent` to the fileName overloads of Process.Run/RunAsync (net11 preview6 inserts it after arguments, before timeout/cancellationToken)
…nt-param-on-Run/RunAsync
…nt-param-on-Run/RunAsync
SimonCropp
deleted the
Add-net11-Process.TryGetProcessById-and-silent-param-on-Run/RunAsync
branch
July 14, 2026 21:25
This was referenced Jul 14, 2026
Closed
Closed
This was referenced Jul 15, 2026
Closed
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the
Processpolyfill in line with the .NET 11 BCL surface:silentoverloads toProcess.Run/Process.RunAsync(suppress child stdout/stderr).Process.TryGetProcessById(int, out Process?).RunandRunAsyncgained abool silentparameter, and to match the real .NET 11 signatures it was inserted in the middle of the parameter list — not appended at the end:Because the new parameter sits in the 3rd positional slot (ahead of
timeout/cancellationToken), any caller that passed the third argument positionally no longer compiles:Polyfill ships as source, so this is a source/compile-time break that surfaces the moment a consumer updates the package and rebuilds (there's no binary-compat layer to absorb it). All existing
Run/RunAsynccall sites using a positional 3rd argument must be updated.Why insert mid-list instead of appending?
The parameter order deliberately mirrors the .NET 11 BCL:
Process.Run(string, IList<string>, bool, TimeSpan?)Process.RunAsync(string, IList<string>, bool, CancellationToken)Appending
silentat the end would keep source-compat today but diverge from the BCL, so the same call would break later when a consumer moves to net11 and the polyfill retires in favor of the framework method (ProcessPolyfill.csis gated#if !NET11_0_OR_GREATER). Taking the one-time break now keeps call sites identical across the polyfill→BCL boundary.Migration
Use named arguments for the trailing parameter:
Or pass
silentexplicitly if adopting the new behavior.Non-breaking additions
Process.TryGetProcessById(int processId, out Process? process)— purely additive (throwsArgumentOutOfRangeExceptionforprocessId <= 0, returnsfalsewhen no such process exists).silent: trueonRun/RunAsyncredirects and discards stdout/stderr. Note: on pre-net11 the polyfill suppresses by redirecting-and-discarding (stdin stays connected), which differs slightly from net11 binding to the null device.