Allow null arguments in ProcessStartInfo constructor and Process.Start#126076
Allow null arguments in ProcessStartInfo constructor and Process.Start#126076adamsitnik merged 3 commits intomainfrom
Conversation
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/2eda673e-5162-4955-bb42-3b4c0613c8bc
There was a problem hiding this comment.
Pull request overview
Updates System.Diagnostics.Process APIs to allow arguments to be nullable (string?) for the ProcessStartInfo(string, ...) ctor and Process.Start(string, ...) overload, aligning annotations with intended behavior.
Changes:
- Annotate
ProcessStartInfo(string fileName, string? arguments)to allow null arguments. - Annotate
Process.Start(string fileName, string? arguments)to allow null arguments. - Update the reference assembly and add a unit test for null
Arguments.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.cs | Makes the (string fileName, string? arguments) ctor accept nullable arguments. |
| src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs | Makes Process.Start(string, string? arguments) accept nullable arguments and forwards to ProcessStartInfo. |
| src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs | Updates public API surface in ref to match new nullability annotations. |
| src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs | Adds coverage asserting null arguments round-trip as string.Empty. |
src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs
Outdated
Show resolved
Hide resolved
adamsitnik
left a comment
There was a problem hiding this comment.
LGTM assuming the tests are going to pass
|
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Note This review was generated by Copilot. 🤖 Copilot Code Review — PR #126076Holistic AssessmentMotivation: Justified. The Approach: Correct and minimal. The change updates only the two signatures in the approved API proposal, and the existing null-coalescing in the Summary: Detailed Findings✅ Correctness — Null is safely handled at all consumption pointsThe
No null-safety risk from this change. Flagged by: Claude, GPT-5.4. ✅ API Approval — Proposed shape matches issue #124093Issue #124093 proposes exactly these two signature changes: - public ProcessStartInfo(string fileName, string arguments)
+ public ProcessStartInfo(string fileName, string? arguments)
- public static Process Start(string fileName, string arguments)
+ public static Process Start(string fileName, string? arguments)The
|
src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.cs
Show resolved
Hide resolved
|
/ba-g the timeouts are very unlikely to be related to this change.. |
Nullability-only annotation update:
argumentsinProcessStartInfo(string, string)andProcess.Start(string, string)was typed as non-nullable but silently acceptednullat runtime (stored asnull, getter returnsstring.Emptyvia??). This aligns the public API contract with actual behavior.Changes
ProcessStartInfo.cs—string arguments→string? argumentsin the two-arg constructorProcess.cs—string arguments→string? argumentsinProcess.Start(string, string)ref/System.Diagnostics.Process.cs— updated reference assembly to matchProcessStartInfoTests.cs— addedTestArgumentsNullPropertycovering null passed to constructor and assigned via propertyOriginal prompt
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.