dotnet / dotnet/dotnet-api-docs

Clarify documentation of Process.Start return value

Open
#10,664 2 comments 0 reactions 0 assignees View on GitHub
area-System.Diagnostics.Process documentation help wanted Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

### Description

Current documentation:

> The return value true indicates that a new process resource was started. If the process resource specified by the [FileName](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.filename?view=net-8.0) member of the [StartInfo](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.startinfo?view=net-8.0) property is already running on the computer, no additional process resource is started. Instead, the running process resource is reused and false is returned.

This is generally not true. If `UseShellExecute` is false (or on Unix where `UseShellExecute` is ignored), Start will never return false.
If UseShellExecute is true Start may return false if a new process isn't created... as the ShellExecuteEx docs call out:

> hProcess will be NULL if no process was launched. For example, if a document to be launched is a URL and an instance of Internet Explorer is already running, it will display the document. No new process is launched, and hProcess will be NULL.

### Reproduction Steps

n/a

### Expected behavior

n/a

### Actual behavior

n/a

### Regression?

_No response_

### Known Workarounds

_No response_

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.